Shit *get_shituser(char *userhost, char *channel) { ChanUser *cu; Chan *chan; Shit *shit; char *p; #ifdef DEBUG debug("(get_shituser) userhost = '%s', channel = '%s'\n", nullstr(userhost),nullstr(channel)); #endif /* DEBUG */ /* * save us a few million function calls if the shitlist is empty */ if (!current->shitlist) return(NULL); if (!nickcmp(current->nick,userhost)) return(NULL); for(chan=current->chanlist;chan;chan=chan->next) { for(cu=chan->users;cu;cu=cu->next) { p = get_nuh(cu); if (matches(userhost,p)) continue; if ((shit = find_shit(p,channel)) != NULL) return(shit); } } return(NULL); }
void check_kicksay(Chan *chan, ChanUser *doer, char *text) { KickSay *kick,*save; char *mask; int action; save = NULL; action = -1; for(kick=current->kicklist;kick;kick=kick->next) { if (*kick->chan == '*' || !Strcasecmp(chan->name,kick->chan)) { if (!matches(kick->mask,text)) { if (kick->action > action) { action = kick->action; save = kick; } } } } if (save) { if (!action) { if (doer->flags & CU_KSWARN) action = 1; if (!(doer->flags & CU_KSWARN)) { doer->flags |= CU_KSWARN; to_server("NOTICE %s :%s\n",doer->nick,save->reason); } } if (action > 1) { mask = format_uh(get_nuh(doer),FUH_USERHOST); if (action > 2) { add_shit("Auto KS",chan->name,mask,save->reason,2,now+3600); } if (!(doer->flags & CU_BANNED)) { doer->flags |= CU_BANNED; send_mode(chan,90,QM_RAWMODE,'+','b',mask); } } if (action && !(doer->flags & CU_KICKED)) { doer->flags |= CU_KICKED; send_kick(chan,CurrentNick,FMT_PLAIN,save->reason); } } }
void shit_action(Chan *chan, ChanUser *cu) { Shit *shit; const char *nick; char *fromnick; char *userhost; if (!chan->setting[TOG_SHIT].int_var || !chan->bot_is_op || cu->user) return; userhost = get_nuh(cu); if ((cu->shit = find_shit(userhost,chan->name)) == NULL) return; shit = cu->shit; if (shit->action == SHIT_KB || shit->action == SHIT_PERMABAN) { nick = cu->nick; send_mode(chan,85,QM_CHANUSER,'-','o',cu); send_mode(chan,90,QM_RAWMODE,'+','b',shit->mask); fromnick = nickcpy(NULL,shit->from); send_kick(chan,nick,"%s %s: %s",time2small(shit->time),fromnick, (shit->reason) ? shit->reason : "GET THE HELL OUT!!!"); return; } else /* * shitlevel 1: not allowed to be chanop */ if (shit->action == SHIT_CHANOP) { send_mode(chan,160,QM_CHANUSER,'-','o',(void*)cu); } }