mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 15:36:50 +00:00
Merge pull request #40 from joonicks/joonix-dev
more .c files consolidated
This commit is contained in:
commit
cc752e9ccd
4
Makefile
4
Makefile
@ -55,9 +55,9 @@ TESTFILES = config/cc.c config/endian.c config/inet_addr.c config/inet_aton.c co
|
||||
|
||||
TRIVFILES = trivia/mkindex.c
|
||||
|
||||
SRCFILES = src/alias.c src/auth.c src/bounce.c src/chanban.c src/channel.c src/core.c src/ctcp.c src/debug.c src/dns.c \
|
||||
SRCFILES = src/alias.c src/auth.c src/bounce.c src/channel.c src/core.c src/ctcp.c src/debug.c src/dns.c \
|
||||
src/function.c src/gencmd.c src/greet.c src/help.c src/hostinfo.c src/irc.c src/kicksay.c src/main.c src/mega.c \
|
||||
src/net.c src/net_chan.c src/note.c src/notify.c src/ons.c src/parse.c src/partyline.c src/perl.c src/prot.c \
|
||||
src/net.c src/note.c src/notify.c src/ons.c src/parse.c src/partyline.c src/perl.c src/prot.c \
|
||||
src/python.c src/reset.c src/seen.c src/shit.c src/socket.c src/spy.c src/tcl.c \
|
||||
src/toybox.c src/trivia.c src/uptime.c src/user.c src/vars.c src/web.c \
|
||||
src/lib/md5.c src/lib/md5.h src/lib/string.c
|
||||
|
||||
@ -47,13 +47,13 @@ INCS = $(BASEINCLUDES) mcmd.h text.h usercombo.h
|
||||
|
||||
TESTFILES = aliastest safepathtest
|
||||
|
||||
OFILES = alias.o auth.o bounce.o chanban.o channel.o core.o ctcp.o debug.o dns.o function.o greet.o \
|
||||
help.o hostinfo.o irc.o kicksay.o main.o net.o net_chan.o note.o notify.o ons.o parse.o partyline.o \
|
||||
OFILES = alias.o auth.o bounce.o channel.o core.o ctcp.o debug.o dns.o function.o greet.o \
|
||||
help.o hostinfo.o irc.o kicksay.o main.o net.o note.o notify.o ons.o parse.o partyline.o \
|
||||
perl.o prot.o python.o reset.o seen.o shit.o socket.o spy.o tcl.o toybox.o \
|
||||
trivia.o uptime.o user.o vars.o web.o lib/string.o @MD5_O@ @SHA_O@
|
||||
|
||||
SRCFILES = alias.c auth.c bounce.c chanban.c channel.c core.c ctcp.c debug.c dns.c function.c greet.c \
|
||||
help.c hostinfo.c irc.c kicksay.c main.c net.c net_chan.c note.c notify.c ons.c parse.c partyline.c \
|
||||
SRCFILES = alias.c auth.c bounce.c channel.c core.c ctcp.c debug.c dns.c function.c greet.c \
|
||||
help.c hostinfo.c irc.c kicksay.c main.c net.c note.c notify.c ons.c parse.c partyline.c \
|
||||
perl.c prot.c python.c reset.c seen.c shit.c socket.c spy.c tcl.c toybox.c \
|
||||
trivia.c uptime.c user.c vars.c web.c lib/string.c @MD5_C@ @SHA_C@
|
||||
|
||||
@ -152,9 +152,6 @@ auth.o: auth.c $(INCS)
|
||||
bounce.o: bounce.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
chanban.o: chanban.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
channel.o: channel.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
@ -194,9 +191,6 @@ main.o: main.c $(INCS)
|
||||
net.o: net.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
net_chan.o: net_chan.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
note.o: note.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
|
||||
161
src/chanban.c
161
src/chanban.c
@ -1,161 +0,0 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Copyright (c) 2009 proton
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
#define CHANBAN_C
|
||||
#include "config.h"
|
||||
|
||||
#ifdef CHANBAN
|
||||
|
||||
#include "defines.h"
|
||||
#include "structs.h"
|
||||
#include "global.h"
|
||||
#include "h.h"
|
||||
|
||||
/*
|
||||
|
||||
if the chanban setting is on, make a whois for all that join #mychannel
|
||||
if #bannedchannel is in their list of channels, kickban them with appropriate message
|
||||
check people randomly, if their whois is old and sendq is empty, do a new whois on them
|
||||
never kickban people on the same channel as the bot
|
||||
TODO: never kickban authenticated people
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* called from main doit() loop
|
||||
* current is not set
|
||||
*/
|
||||
void process_chanbans(void)
|
||||
{
|
||||
Strp *sp,**pp;
|
||||
Chan *anychan;
|
||||
ChanUser *cu,*selcu;
|
||||
|
||||
for (current=botlist;current;current=current->next)
|
||||
{
|
||||
if (current->lastchanban > (now - 10))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(process_chanbans) skipping %s (%i), (lastchanban (%lu) > now - 10 (%lu)\n",
|
||||
current->nick,current->guid,current->lastchanban,(now - 10));
|
||||
#endif /* DEBUG */
|
||||
continue;
|
||||
}
|
||||
if (current->sendq) // only do chanbans on empty queue
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",current->nick,current->guid);
|
||||
#endif /* DEBUG */
|
||||
continue;
|
||||
}
|
||||
|
||||
selcu = NULL;
|
||||
for(anychan=current->chanlist;anychan;anychan=anychan->next)
|
||||
{
|
||||
if (anychan->modelist || anychan->kicklist) // only do chanbans on empty queue
|
||||
goto has_queue;
|
||||
if (anychan->setting[TOG_CHANBAN].int_var && anychan->bot_is_op)
|
||||
{
|
||||
for(cu=anychan->users;cu;cu=cu->next)
|
||||
{
|
||||
if (cu->user)
|
||||
{
|
||||
if (!selcu || cu->lastwhois < selcu->lastwhois)
|
||||
{
|
||||
selcu = cu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selcu && selcu->lastwhois < (now-30))
|
||||
{
|
||||
selcu->flags &= ~CU_CHANBAN;
|
||||
selcu->lastwhois = now;
|
||||
current->lastchanban = now;
|
||||
|
||||
pp = ¤t->sendq;
|
||||
while(*pp)
|
||||
pp = &(*pp)->next;
|
||||
set_mallocdoer(process_chanbans);
|
||||
*pp = sp = (Strp*)Calloc(sizeof(Strp) + 6 + strlen(selcu->nick));
|
||||
sprintf(sp->p,"WHOIS %s",selcu->nick);
|
||||
/* Calloc sets to zero sp->next = NULL; */
|
||||
}
|
||||
has_queue:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void chanban_action(char *nick, char *channel, Shit *shit)
|
||||
{
|
||||
ChanUser *cu;
|
||||
char *nuh;
|
||||
|
||||
// the channel is shitted and the user is on it...
|
||||
// 1, make sure the bot isnt on the channel
|
||||
// 2, kb the user on all channels where the shit is active and i am op
|
||||
|
||||
// check all current channels
|
||||
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
|
||||
{
|
||||
if (!stringcasecmp(channel,CurrentChan->name)) // if the bot is on the channel, skip it
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(chanban_action) skipping %s: bot is on channel\n",channel);
|
||||
#endif /* DEBUG */
|
||||
return;
|
||||
}
|
||||
// is the shit for this channel?
|
||||
if (!stringcasecmp(shit->chan,CurrentChan->name))
|
||||
{
|
||||
// if chanban is turned on && if bot is op (pretty pointless otherwise)
|
||||
if (CurrentChan->setting[TOG_CHANBAN].int_var && CurrentChan->bot_is_op)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(chanban_action) %s: Tog is on, I am op\n",CurrentChan->name);
|
||||
#endif /* DEBUG */
|
||||
cu = find_chanuser(CurrentChan,nick);
|
||||
if (!(cu->flags & CU_CHANBAN))
|
||||
// dont kickban the same user multiple times from the same channel
|
||||
{
|
||||
nuh = get_nuh(cu); // clobbers nuh_buf
|
||||
#ifdef DEBUG
|
||||
debug("(chanban_action) slapping %s on %s for being on %s (mask %s): %s\n",
|
||||
nick,CurrentChan->name,channel,shit->mask,shit->reason);
|
||||
#endif /* DEBUG */
|
||||
cu->flags |= CU_CHANBAN;
|
||||
format_uh(nuh,1); // returns mask in 'nuh' buffer (nuh_buf)
|
||||
send_mode(CurrentChan,90,QM_RAWMODE,'+','b',(void*)nuh);
|
||||
send_kick(CurrentChan,nick,"%s (%s)",shit->reason,channel); // clobbers gsockdata
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* commands
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* CHANBAN */
|
||||
@ -574,6 +574,29 @@ ChanUser *find_chanuser(Chan *chan, const char *nick)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#ifdef BOTNET
|
||||
|
||||
ChanUser *find_chanbot(Chan *chan, const char *nick)
|
||||
{
|
||||
ChanUser *cu;
|
||||
|
||||
if (chan->cacheuser && !nickcmp(nick,chan->cacheuser->nick)
|
||||
&& chan->cacheuser->user && chan->cacheuser->user->x.x.access == BOTLEVEL)
|
||||
return(chan->cacheuser);
|
||||
|
||||
for(cu=chan->users;cu;cu=cu->next)
|
||||
{
|
||||
if (cu->user && cu->user->x.x.access == BOTLEVEL)
|
||||
{
|
||||
if (!nickcmp(nick,cu->nick))
|
||||
return(chan->cacheuser = cu);
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* BOTNET */
|
||||
|
||||
void remove_chanuser(Chan *chan, const char *nick)
|
||||
{
|
||||
ChanUser *cu,**pp;
|
||||
|
||||
201
src/h.h
201
src/h.h
@ -136,11 +136,6 @@ void new_port_bounce(const struct Setting *);
|
||||
void select_bounce(void);
|
||||
void process_bounce(void);
|
||||
|
||||
/* chanban.c */
|
||||
|
||||
void process_chanbans(void);
|
||||
void chanban_action(char *, char *, Shit *);
|
||||
|
||||
/* channel.c */
|
||||
|
||||
void check_idlekick(void);
|
||||
@ -160,26 +155,27 @@ void delete_modemask(Chan *, char *, int);
|
||||
void purge_banlist(Chan *);
|
||||
void channel_massmode(const Chan *, char *, int, char, char);
|
||||
void channel_massunban(Chan *, char *, time_t);
|
||||
ChanUser *find_chanuser(Chan *, const char *);
|
||||
void remove_chanuser(Chan *, const char *);
|
||||
void make_chanuser(char *, char *);
|
||||
void purge_chanusers(Chan *);
|
||||
char *get_nuh(const ChanUser *);
|
||||
void do_join(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_part(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_cycle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_forget(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_channels(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_wall(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_mode(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_names(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_cchan(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_invite(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_sayme(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_who(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_topic(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_showidle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_idle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS ChanUser *find_chanuser(Chan *, const char *);
|
||||
LS ChanUser *find_chanbot(Chan *, const char *);
|
||||
LS void remove_chanuser(Chan *, const char *);
|
||||
LS void make_chanuser(char *, char *);
|
||||
LS void purge_chanusers(Chan *);
|
||||
LS char *get_nuh(const ChanUser *);
|
||||
LS void do_join(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_part(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_cycle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_forget(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_channels(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_wall(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_mode(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_names(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_cchan(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_invite(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_sayme(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_who(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_topic(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_showidle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_idle(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* core.c */
|
||||
|
||||
@ -408,11 +404,15 @@ void botnet_binfo_relay(BotNet *source, BotInfo *binfo);
|
||||
void botnet_binfo_tofile(int sock, BotInfo *binfo);
|
||||
void botnet_dumplinklist(BotNet *bn);
|
||||
int connect_to_bot(NetCfg *cfg);
|
||||
LS void check_botjoin(Chan *chan, ChanUser *cu);
|
||||
LS void check_botinfo(BotInfo *binfo, const char *channel);
|
||||
void basicAuth(BotNet *bn, char *rest);
|
||||
void basicAuthOK(BotNet *bn, char *rest);
|
||||
void basicBanner(BotNet *bn, char *rest);
|
||||
void basicLink(BotNet *bn, char *version);
|
||||
void basicQuit(BotNet *bn, char *rest);
|
||||
LS void netchanNeedop(BotNet *source, char *rest);
|
||||
LS void netchanSuppress(BotNet *, char *) __page(CORE_SEG);
|
||||
void partyAuth(BotNet *bn, char *rest);
|
||||
int commandlocal(int dg, int sg, char *from, char *command);
|
||||
void partyCommand(BotNet *bn, char *rest);
|
||||
@ -420,22 +420,15 @@ void partyMessage(BotNet *bn, char *rest);
|
||||
void ushareUser(BotNet *bn, char *rest);
|
||||
void ushareTick(BotNet *bn, char *rest);
|
||||
void ushareDelete(BotNet *bn, char *rest);
|
||||
void botnet_parse(BotNet *bn, char *rest);
|
||||
void parse_botnet(BotNet *bn, char *rest);
|
||||
void botnet_newsock(void);
|
||||
void select_botnet(void);
|
||||
void process_botnet(void);
|
||||
void do_link(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_cmd(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* net_chan.c */
|
||||
|
||||
LS int makecrc(const char *) __page(CORE_SEG);
|
||||
LS void send_suppress(const char *, const char *) __page(CORE_SEG);
|
||||
ChanUser *find_chanbot(Chan *chan, char *nick);
|
||||
void check_botjoin(Chan *chan, ChanUser *cu);
|
||||
void check_botinfo(BotInfo *binfo, const char *channel);
|
||||
void netchanNeedop(BotNet *source, char *rest);
|
||||
LS void netchanSuppress(BotNet *, char *) __page(CORE_SEG);
|
||||
|
||||
|
||||
/* note.c */
|
||||
|
||||
@ -462,62 +455,64 @@ void do_notify(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* ons.c */
|
||||
|
||||
void on_kick(char *from, char *rest);
|
||||
void on_join(Chan *chan, char *from);
|
||||
void on_nick(char *from, char *newnick);
|
||||
void on_msg(char *from, char *to, char *rest);
|
||||
void on_mode(char *from, char *channel, char *rest);
|
||||
void common_public(Chan *chan, char *from, char *spyformat, char *rest);
|
||||
void on_action(char *from, char *to, char *rest);
|
||||
int access_needed(char *name);
|
||||
void do_chaccess(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_last(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS uint32_t makecrc(const char *) __page(CORE_SEG);
|
||||
LS void send_suppress(const char *, const char *) __page(CORE_SEG);
|
||||
LS void on_kick(char *from, char *rest);
|
||||
LS void on_join(Chan *chan, char *from);
|
||||
LS void on_nick(char *from, char *newnick);
|
||||
LS void on_msg(char *from, char *to, char *rest);
|
||||
LS void on_mode(char *from, char *channel, char *rest);
|
||||
LS void common_public(Chan *chan, char *from, char *spyformat, char *rest);
|
||||
LS void on_action(char *from, char *to, char *rest);
|
||||
LS int access_needed(char *name);
|
||||
LS void do_chaccess(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_last(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* parse.c */
|
||||
|
||||
void parse_error(char *from, char *rest);
|
||||
void parse_invite(char *from, char *rest);
|
||||
void parse_join(char *from, char *rest);
|
||||
void parse_mode(char *from, char *rest);
|
||||
void parse_notice(char *from, char *rest);
|
||||
void parse_part(char *from, char *rest);
|
||||
void parse_ping(char *from, char *rest);
|
||||
void parse_pong(char *from, char *rest);
|
||||
void parse_privmsg(char *from, char *rest);
|
||||
void parse_quit(char *from, char *rest);
|
||||
void parse_topic(char *from, char *rest);
|
||||
void parse_wallops(char *from, char *rest);
|
||||
void parse_213(char *from, char *rest);
|
||||
void parse_219(char *from, char *rest);
|
||||
void parse_251(char *from, char *rest);
|
||||
void parse_252(char *from, char *rest);
|
||||
void parse_253(char *from, char *rest);
|
||||
void parse_254(char *from, char *rest);
|
||||
void parse_255(char *from, char *rest);
|
||||
void parse_301(char *from, char *rest);
|
||||
void parse_303(char *from, char *rest);
|
||||
void parse_311(char *from, char *rest);
|
||||
void parse_312(char *from, char *rest);
|
||||
void parse_313(char *from, char *rest);
|
||||
void parse_315(char *from, char *rest);
|
||||
void parse_317(char *from, char *rest);
|
||||
void parse_318(char *from, char *rest);
|
||||
void parse_319(char *from, char *rest);
|
||||
void parse_324(char *from, char *rest);
|
||||
void parse_352(char *from, char *rest);
|
||||
void parse_367(char *from, char *rest);
|
||||
void parse_376(char *from, char *rest);
|
||||
void parse_401(char *from, char *rest);
|
||||
void parse_433(char *from, char *rest);
|
||||
void parse_451(char *from, char *rest);
|
||||
void parse_471(char *from, char *rest);
|
||||
void parse_473(char *from, char *rest);
|
||||
void parse_346(char *from, char *rest);
|
||||
void parse_348(char *from, char *rest);
|
||||
void parse_368(char *from, char *rest);
|
||||
void parse_005(char *from, char *rest);
|
||||
uint32_t stringhash(char *s);
|
||||
void parseline(char *rest);
|
||||
LS void parse_error(char *from, char *rest);
|
||||
LS void parse_invite(char *from, char *rest);
|
||||
LS void parse_join(char *from, char *rest);
|
||||
LS void parse_mode(char *from, char *rest);
|
||||
LS void parse_notice(char *from, char *rest);
|
||||
LS void parse_part(char *from, char *rest);
|
||||
LS void parse_ping(char *from, char *rest);
|
||||
LS void parse_pong(char *from, char *rest);
|
||||
LS void parse_privmsg(char *from, char *rest);
|
||||
LS void parse_quit(char *from, char *rest);
|
||||
LS void parse_topic(char *from, char *rest);
|
||||
LS void parse_wallops(char *from, char *rest);
|
||||
LS void parse_213(char *from, char *rest);
|
||||
LS void parse_219(char *from, char *rest);
|
||||
LS void parse_251(char *from, char *rest);
|
||||
LS void parse_252(char *from, char *rest);
|
||||
LS void parse_253(char *from, char *rest);
|
||||
LS void parse_254(char *from, char *rest);
|
||||
LS void parse_255(char *from, char *rest);
|
||||
LS void parse_301(char *from, char *rest);
|
||||
LS void parse_303(char *from, char *rest);
|
||||
LS void parse_311(char *from, char *rest);
|
||||
LS void parse_312(char *from, char *rest);
|
||||
LS void parse_313(char *from, char *rest);
|
||||
LS void parse_315(char *from, char *rest);
|
||||
LS void parse_317(char *from, char *rest);
|
||||
LS void parse_318(char *from, char *rest);
|
||||
LS void parse_319(char *from, char *rest);
|
||||
LS void parse_324(char *from, char *rest);
|
||||
LS void parse_352(char *from, char *rest);
|
||||
LS void parse_367(char *from, char *rest);
|
||||
LS void parse_376(char *from, char *rest);
|
||||
LS void parse_401(char *from, char *rest);
|
||||
LS void parse_433(char *from, char *rest);
|
||||
LS void parse_451(char *from, char *rest);
|
||||
LS void parse_471(char *from, char *rest);
|
||||
LS void parse_473(char *from, char *rest);
|
||||
LS void parse_346(char *from, char *rest);
|
||||
LS void parse_348(char *from, char *rest);
|
||||
LS void parse_368(char *from, char *rest);
|
||||
LS void parse_005(char *from, char *rest);
|
||||
LS uint32_t stringhash(char *s);
|
||||
LS void parseline(char *rest);
|
||||
|
||||
/* partyline.c */
|
||||
|
||||
@ -540,22 +535,24 @@ LS void do_perlscript(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* prot.c */
|
||||
|
||||
void send_kick(Chan *chan, const char *nick, const char *format, ...);
|
||||
void push_kicks(Chan *chan);
|
||||
void unmode_chanuser(Chan *chan, ChanUser *cu);
|
||||
void send_mode(Chan *chan, int pri, int type, char plusminus, char modeflag, void *data);
|
||||
int mode_effect(Chan *chan, qMode *mode);
|
||||
void push_modes(Chan *chan, int lowpri);
|
||||
void update_modes(Chan *chan);
|
||||
int check_mass(Chan *chan, ChanUser *doer, int type);
|
||||
void mass_action(Chan *chan, ChanUser *doer);
|
||||
void prot_action(Chan *chan, char *from, ChanUser *doer, char *target, ChanUser *victim);
|
||||
LS void send_kick(Chan *chan, const char *nick, const char *format, ...);
|
||||
LS void push_kicks(Chan *chan);
|
||||
LS void unmode_chanuser(Chan *chan, ChanUser *cu);
|
||||
LS void send_mode(Chan *chan, int pri, int type, char plusminus, char modeflag, void *data);
|
||||
LS int mode_effect(Chan *chan, qMode *mode);
|
||||
LS void push_modes(Chan *chan, int lowpri);
|
||||
LS void update_modes(Chan *chan);
|
||||
LS int check_mass(Chan *chan, ChanUser *doer, int type);
|
||||
LS void mass_action(Chan *chan, ChanUser *doer);
|
||||
LS void prot_action(Chan *chan, char *from, ChanUser *doer, char *target, ChanUser *victim);
|
||||
LS void process_chanbans(void);
|
||||
LS void chanban_action(char *, char *, Shit *);
|
||||
LS void check_dynamode(Chan *) __page(CORE_SEG);
|
||||
void do_opdeopme(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_opvoice(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_kickban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_unban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_banlist(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_opdeopme(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_opvoice(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_kickban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_unban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_banlist(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* python.c */
|
||||
#ifdef PYTHON
|
||||
|
||||
@ -129,7 +129,7 @@ void purge_kicklist(void)
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* kicksay commands
|
||||
*
|
||||
*/
|
||||
@ -262,4 +262,3 @@ void do_rkicksay(COMMAND_ARGS)
|
||||
usage:
|
||||
usage(from); /* usage for CurrentCmd->name */
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
#include "alias.c"
|
||||
#include "auth.c"
|
||||
#include "bounce.c"
|
||||
#include "chanban.c"
|
||||
#include "channel.c"
|
||||
#include "core.c"
|
||||
#include "ctcp.c"
|
||||
@ -29,7 +28,6 @@
|
||||
#include "lib/string.c"
|
||||
#include "main.c"
|
||||
#include "net.c"
|
||||
#include "net_chan.c"
|
||||
#include "note.c"
|
||||
#include "notify.c"
|
||||
#include "ons.c"
|
||||
|
||||
138
src/net.c
138
src/net.c
@ -295,6 +295,66 @@ int connect_to_bot(NetCfg *cfg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
void check_botjoin(Chan *chan, ChanUser *cu)
|
||||
{
|
||||
BotNet *bn;
|
||||
BotInfo *binfo;
|
||||
|
||||
#ifdef DEBUG
|
||||
debug("(check_botjoin) chan = %s; cu = %s!%s\n",chan->name,cu->nick,cu->userhost);
|
||||
#endif /* DEBUG */
|
||||
|
||||
for(bn=botnetlist;bn;bn=bn->next)
|
||||
{
|
||||
if (bn->status != BN_LINKED)
|
||||
continue;
|
||||
|
||||
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
||||
{
|
||||
if (!nickcmp(cu->nick,binfo->nuh) &&
|
||||
!stringcasecmp(cu->userhost,getuh(binfo->nuh)))
|
||||
{
|
||||
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
||||
return;
|
||||
cu->flags |= CU_NEEDOP;
|
||||
send_mode(chan,50,QM_CHANUSER,'+','o',(void*)cu);
|
||||
#ifdef DEBUG
|
||||
debug("(check_botjoin) CU_NEEDOP set, mode pushed\n");
|
||||
#endif /* DEBUG */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_botinfo(BotInfo *binfo, const char *channel)
|
||||
{
|
||||
Chan *chan;
|
||||
ChanUser *cu;
|
||||
Mech *backup;
|
||||
char *userhost;
|
||||
|
||||
userhost = getuh(binfo->nuh);
|
||||
|
||||
backup = current;
|
||||
for(current=botlist;current;current=current->next)
|
||||
{
|
||||
for(chan=current->chanlist;chan;chan=chan->next)
|
||||
{
|
||||
if (channel && stringcasecmp(channel,chan->name))
|
||||
continue;
|
||||
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
||||
continue;
|
||||
if (!stringcasecmp(cu->userhost,userhost))
|
||||
{
|
||||
cu->flags |= CU_NEEDOP;
|
||||
send_mode(chan,50,QM_CHANUSER,'+','o',(void*)cu);
|
||||
}
|
||||
}
|
||||
}
|
||||
current = backup;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* protocol routines
|
||||
@ -769,7 +829,76 @@ void basicQuit(BotNet *bn, char *rest)
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* netchan protocol routines
|
||||
*/
|
||||
|
||||
void netchanNeedop(BotNet *source, char *rest)
|
||||
{
|
||||
BotNet *bn;
|
||||
BotInfo *binfo;
|
||||
char *channel;
|
||||
int guid;
|
||||
|
||||
guid = asc2int(chop(&rest));
|
||||
channel = chop(&rest);
|
||||
if (errno || guid < 1 || !channel)
|
||||
return;
|
||||
|
||||
botnet_relay(source,"CO%i %s\n",guid,channel);
|
||||
|
||||
for(bn=botnetlist;bn;bn=bn->next)
|
||||
{
|
||||
if (bn->status != BN_LINKED)
|
||||
continue;
|
||||
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
||||
{
|
||||
if (binfo->guid == guid)
|
||||
check_botinfo(binfo,channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SUPPRESS
|
||||
|
||||
void netchanSuppress(BotNet *source, char *rest)
|
||||
{
|
||||
Mech *backup;
|
||||
const char *cmd;
|
||||
int crc,i,j;
|
||||
|
||||
botnet_relay(source,"CS%s\n",rest);
|
||||
|
||||
cmd = chop(&rest);
|
||||
|
||||
// convert command to const command
|
||||
for(i=0;mcmd[i].name;i++)
|
||||
{
|
||||
j = stringcasecmp(mcmd[i].name,cmd);
|
||||
if (j < 0)
|
||||
continue;
|
||||
if (j > 0)
|
||||
return;
|
||||
cmd = mcmd[i].name;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mcmd[i].name == NULL)
|
||||
return;
|
||||
|
||||
crc = asc2int(rest);
|
||||
|
||||
// to all local bots
|
||||
for(backup=botlist;backup;backup=backup->next)
|
||||
{
|
||||
backup->supres_cmd = cmd;
|
||||
backup->supres_crc = crc;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SUPPRESS */
|
||||
|
||||
/*
|
||||
* paryline protocol routines
|
||||
*/
|
||||
|
||||
void partyAuth(BotNet *bn, char *rest)
|
||||
@ -979,7 +1108,7 @@ void partyMessage(BotNet *bn, char *rest)
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* use sharing protocol routines
|
||||
*/
|
||||
|
||||
void ushareUser(BotNet *bn, char *rest)
|
||||
@ -1218,7 +1347,7 @@ void ushareDelete(BotNet *bn, char *rest)
|
||||
*
|
||||
*/
|
||||
|
||||
void botnet_parse(BotNet *bn, char *rest)
|
||||
void parse_botnet(BotNet *bn, char *rest)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1427,7 +1556,7 @@ void process_botnet(void)
|
||||
bn->has_data = (rest) ? TRUE : FALSE;
|
||||
if (rest)
|
||||
{
|
||||
botnet_parse(bn,rest);
|
||||
parse_botnet(bn,rest);
|
||||
if (!deadlinks)
|
||||
goto has_data; /* process more lines if link list is unchanged */
|
||||
goto clean;
|
||||
@ -1655,4 +1784,5 @@ void do_cmd(COMMAND_ARGS)
|
||||
}
|
||||
|
||||
#endif /* REDIRECT */
|
||||
|
||||
#endif /* BOTNET */
|
||||
|
||||
217
src/net_chan.c
217
src/net_chan.c
@ -1,217 +0,0 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Copyright (c) 1997-2018 proton
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
#define NET_C
|
||||
#include "config.h"
|
||||
|
||||
#ifdef BOTNET
|
||||
|
||||
#include "defines.h"
|
||||
#include "structs.h"
|
||||
#include "global.h"
|
||||
#include "h.h"
|
||||
#include "text.h"
|
||||
#include "mcmd.h"
|
||||
|
||||
#ifdef SUPPRESS
|
||||
|
||||
int makecrc(const char *args)
|
||||
{
|
||||
int crc = 0;
|
||||
|
||||
while(*args)
|
||||
{
|
||||
crc += ((12345 * *args) % 321) + 4567;
|
||||
args++;
|
||||
}
|
||||
|
||||
return(crc);
|
||||
}
|
||||
|
||||
void send_suppress(const char *command, const char *args)
|
||||
{
|
||||
Mech *backup;
|
||||
int crc;
|
||||
|
||||
crc = makecrc(args);
|
||||
for(backup=botlist;backup;backup=backup->next)
|
||||
{
|
||||
if (backup != current)
|
||||
{
|
||||
backup->supres_cmd = command;
|
||||
backup->supres_crc = crc;
|
||||
}
|
||||
}
|
||||
botnet_relay(NULL,"CS%s %i\n",command,crc);
|
||||
}
|
||||
|
||||
#endif /* SUPPRESS */
|
||||
|
||||
ChanUser *find_chanbot(Chan *chan, char *nick)
|
||||
{
|
||||
ChanUser *cu;
|
||||
|
||||
if (chan->cacheuser && !nickcmp(nick,chan->cacheuser->nick)
|
||||
&& chan->cacheuser->user && chan->cacheuser->user->x.x.access == BOTLEVEL)
|
||||
return(chan->cacheuser);
|
||||
|
||||
for(cu=chan->users;cu;cu=cu->next)
|
||||
{
|
||||
if (cu->user && cu->user->x.x.access == BOTLEVEL)
|
||||
{
|
||||
if (!nickcmp(nick,cu->nick))
|
||||
return(chan->cacheuser = cu);
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void check_botjoin(Chan *chan, ChanUser *cu)
|
||||
{
|
||||
BotNet *bn;
|
||||
BotInfo *binfo;
|
||||
|
||||
#ifdef DEBUG
|
||||
debug("(check_botjoin) chan = %s; cu = %s!%s\n",chan->name,cu->nick,cu->userhost);
|
||||
#endif /* DEBUG */
|
||||
|
||||
for(bn=botnetlist;bn;bn=bn->next)
|
||||
{
|
||||
if (bn->status != BN_LINKED)
|
||||
continue;
|
||||
|
||||
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
||||
{
|
||||
if (!nickcmp(cu->nick,binfo->nuh) &&
|
||||
!stringcasecmp(cu->userhost,getuh(binfo->nuh)))
|
||||
{
|
||||
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
||||
return;
|
||||
cu->flags |= CU_NEEDOP;
|
||||
send_mode(chan,50,QM_CHANUSER,'+','o',(void*)cu);
|
||||
#ifdef DEBUG
|
||||
debug("(check_botjoin) CU_NEEDOP set, mode pushed\n");
|
||||
#endif /* DEBUG */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_botinfo(BotInfo *binfo, const char *channel)
|
||||
{
|
||||
Chan *chan;
|
||||
ChanUser *cu;
|
||||
Mech *backup;
|
||||
char *userhost;
|
||||
|
||||
userhost = getuh(binfo->nuh);
|
||||
|
||||
backup = current;
|
||||
for(current=botlist;current;current=current->next)
|
||||
{
|
||||
for(chan=current->chanlist;chan;chan=chan->next)
|
||||
{
|
||||
if (channel && stringcasecmp(channel,chan->name))
|
||||
continue;
|
||||
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
||||
continue;
|
||||
if (!stringcasecmp(cu->userhost,userhost))
|
||||
{
|
||||
cu->flags |= CU_NEEDOP;
|
||||
send_mode(chan,50,QM_CHANUSER,'+','o',(void*)cu);
|
||||
}
|
||||
}
|
||||
}
|
||||
current = backup;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* protocol routines
|
||||
*
|
||||
*/
|
||||
|
||||
void netchanNeedop(BotNet *source, char *rest)
|
||||
{
|
||||
BotNet *bn;
|
||||
BotInfo *binfo;
|
||||
char *channel;
|
||||
int guid;
|
||||
|
||||
guid = asc2int(chop(&rest));
|
||||
channel = chop(&rest);
|
||||
if (errno || guid < 1 || !channel)
|
||||
return;
|
||||
|
||||
botnet_relay(source,"CO%i %s\n",guid,channel);
|
||||
|
||||
for(bn=botnetlist;bn;bn=bn->next)
|
||||
{
|
||||
if (bn->status != BN_LINKED)
|
||||
continue;
|
||||
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
||||
{
|
||||
if (binfo->guid == guid)
|
||||
check_botinfo(binfo,channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SUPPRESS
|
||||
|
||||
void netchanSuppress(BotNet *source, char *rest)
|
||||
{
|
||||
Mech *backup;
|
||||
const char *cmd;
|
||||
int crc,i,j;
|
||||
|
||||
botnet_relay(source,"CS%s\n",rest);
|
||||
|
||||
cmd = chop(&rest);
|
||||
|
||||
// convert command to const command
|
||||
for(i=0;mcmd[i].name;i++)
|
||||
{
|
||||
j = stringcasecmp(mcmd[i].name,cmd);
|
||||
if (j < 0)
|
||||
continue;
|
||||
if (j > 0)
|
||||
return;
|
||||
cmd = mcmd[i].name;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mcmd[i].name == NULL)
|
||||
return;
|
||||
|
||||
crc = asc2int(rest);
|
||||
|
||||
// to all local bots
|
||||
for(backup=botlist;backup;backup=backup->next)
|
||||
{
|
||||
backup->supres_cmd = cmd;
|
||||
backup->supres_crc = crc;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SUPPRESS */
|
||||
|
||||
#endif /* BOTNET */
|
||||
32
src/ons.c
32
src/ons.c
@ -28,6 +28,38 @@
|
||||
#include "text.h"
|
||||
#include "mcmd.h"
|
||||
|
||||
#ifdef SUPPRESS
|
||||
|
||||
uint32_t makecrc(const char *args)
|
||||
{
|
||||
uint32_t crc = 0;
|
||||
int n = 0;
|
||||
|
||||
while(args[n])
|
||||
crc += ((((crc * 0xc960ebb3) ^ 0x14d0bd4d) + 0x9ff77d71) * args[n++]) - 0xb07daba7;
|
||||
|
||||
return(crc);
|
||||
}
|
||||
|
||||
void send_suppress(const char *command, const char *args)
|
||||
{
|
||||
Mech *backup;
|
||||
int crc;
|
||||
|
||||
crc = makecrc(args);
|
||||
for(backup=botlist;backup;backup=backup->next)
|
||||
{
|
||||
if (backup != current)
|
||||
{
|
||||
backup->supres_cmd = command;
|
||||
backup->supres_crc = crc;
|
||||
}
|
||||
}
|
||||
botnet_relay(NULL,"CS%s %i\n",command,crc);
|
||||
}
|
||||
|
||||
#endif /* SUPPRESS */
|
||||
|
||||
/*
|
||||
* :nick!user@host KICK #channel kicknick :message
|
||||
*/
|
||||
|
||||
132
src/prot.c
132
src/prot.c
@ -1,7 +1,7 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Parts Copyright (c) 1997-2009 proton
|
||||
Parts Copyright (c) 1997-2018 proton
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -470,9 +470,137 @@ void check_dynamode(Chan *chan)
|
||||
|
||||
#endif /* DYNAMODE */
|
||||
|
||||
#ifdef CHANBAN
|
||||
|
||||
/*
|
||||
|
||||
if the chanban setting is on, make a whois for all that join #mychannel
|
||||
if #bannedchannel is in their list of channels, kickban them with appropriate message
|
||||
check people randomly, if their whois is old and sendq is empty, do a new whois on them
|
||||
never kickban people on the same channel as the bot
|
||||
TODO: never kickban authenticated people
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* called from main doit() loop
|
||||
* current is not set
|
||||
*/
|
||||
void process_chanbans(void)
|
||||
{
|
||||
Strp *sp,**pp;
|
||||
Chan *anychan;
|
||||
ChanUser *cu,*selcu;
|
||||
|
||||
for (current=botlist;current;current=current->next)
|
||||
{
|
||||
if (current->lastchanban > (now - 10))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(process_chanbans) skipping %s (%i), (lastchanban (%lu) > now - 10 (%lu)\n",
|
||||
current->nick,current->guid,current->lastchanban,(now - 10));
|
||||
#endif /* DEBUG */
|
||||
continue;
|
||||
}
|
||||
if (current->sendq) // only do chanbans on empty queue
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",current->nick,current->guid);
|
||||
#endif /* DEBUG */
|
||||
continue;
|
||||
}
|
||||
|
||||
selcu = NULL;
|
||||
for(anychan=current->chanlist;anychan;anychan=anychan->next)
|
||||
{
|
||||
if (anychan->modelist || anychan->kicklist) // only do chanbans on empty queue
|
||||
goto has_queue;
|
||||
if (anychan->setting[TOG_CHANBAN].int_var && anychan->bot_is_op)
|
||||
{
|
||||
for(cu=anychan->users;cu;cu=cu->next)
|
||||
{
|
||||
if (cu->user)
|
||||
{
|
||||
if (!selcu || cu->lastwhois < selcu->lastwhois)
|
||||
{
|
||||
selcu = cu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selcu && selcu->lastwhois < (now-30))
|
||||
{
|
||||
selcu->flags &= ~CU_CHANBAN;
|
||||
selcu->lastwhois = now;
|
||||
current->lastchanban = now;
|
||||
|
||||
pp = ¤t->sendq;
|
||||
while(*pp)
|
||||
pp = &(*pp)->next;
|
||||
set_mallocdoer(process_chanbans);
|
||||
*pp = sp = (Strp*)Calloc(sizeof(Strp) + 6 + strlen(selcu->nick));
|
||||
sprintf(sp->p,"WHOIS %s",selcu->nick);
|
||||
/* Calloc sets to zero sp->next = NULL; */
|
||||
}
|
||||
has_queue:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void chanban_action(char *nick, char *channel, Shit *shit)
|
||||
{
|
||||
ChanUser *cu;
|
||||
char *nuh;
|
||||
|
||||
// the channel is shitted and the user is on it...
|
||||
// 1, make sure the bot isnt on the channel
|
||||
// 2, kb the user on all channels where the shit is active and i am op
|
||||
|
||||
// check all current channels
|
||||
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
|
||||
{
|
||||
if (!stringcasecmp(channel,CurrentChan->name)) // if the bot is on the channel, skip it
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(chanban_action) skipping %s: bot is on channel\n",channel);
|
||||
#endif /* DEBUG */
|
||||
return;
|
||||
}
|
||||
// is the shit for this channel?
|
||||
if (!stringcasecmp(shit->chan,CurrentChan->name))
|
||||
{
|
||||
// if chanban is turned on && if bot is op (pretty pointless otherwise)
|
||||
if (CurrentChan->setting[TOG_CHANBAN].int_var && CurrentChan->bot_is_op)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
debug("(chanban_action) %s: Tog is on, I am op\n",CurrentChan->name);
|
||||
#endif /* DEBUG */
|
||||
cu = find_chanuser(CurrentChan,nick);
|
||||
if (!(cu->flags & CU_CHANBAN))
|
||||
// dont kickban the same user multiple times from the same channel
|
||||
{
|
||||
nuh = get_nuh(cu); // clobbers nuh_buf
|
||||
#ifdef DEBUG
|
||||
debug("(chanban_action) slapping %s on %s for being on %s (mask %s): %s\n",
|
||||
nick,CurrentChan->name,channel,shit->mask,shit->reason);
|
||||
#endif /* DEBUG */
|
||||
cu->flags |= CU_CHANBAN;
|
||||
format_uh(nuh,1); // returns mask in 'nuh' buffer (nuh_buf)
|
||||
send_mode(CurrentChan,90,QM_RAWMODE,'+','b',(void*)nuh);
|
||||
send_kick(CurrentChan,nick,"%s (%s)",shit->reason,channel); // clobbers gsockdata
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CHANBAN */
|
||||
|
||||
/*
|
||||
*
|
||||
* mode commands
|
||||
* prot.c commands
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user