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 userhost_ban(UserhostItem *stuff, char *nick1, char *args) { char *temp; char *str= NULL; char *channel; ChannelList *c = NULL; NickList *n = NULL; char *ob = "-o+b"; char *b = "+b"; char *host = NULL, *nick = NULL, *user = NULL, *chan = NULL; WhowasList *whowas = NULL; int f**k = 0; int set_ignore = 0; channel = next_arg(args, &args); temp = next_arg(args, &args); f**k = !my_stricmp("F**K", args); set_ignore = !my_stricmp("BKI", args); if (!stuff || !stuff->nick || !nick1 || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1)) { if (nick1 && channel && (whowas = check_whowas_nick_buffer(nick1, channel, 0))) { nick = whowas->nicklist->nick; user = m_strdup(clear_server_flags(whowas->nicklist->host)); host = strchr(user, '@'); *host++ = 0; bitchsay("Using WhoWas info for ban of %s ", nick1); n = whowas->nicklist; } else if (nick1) { bitchsay("No match for the %s of %s on %s", f**k ? "F**k":"Ban", nick1, channel); return; } } else { nick = stuff->nick; user = m_strdup(clear_server_flags(stuff->user)); host = stuff->host; } if (!(my_stricmp(nick, get_server_nickname(from_server)))) { bitchsay("Try to kick yourself again!!"); new_free(&user); return; } if (is_on_channel(channel, from_server, nick)) chan = channel; c = lookup_channel(channel, from_server, 0); if (c && !n) n = find_nicklist_in_channellist(nick, c, 0); send_to_server("MODE %s %s %s %s", channel, chan ? ob : b, chan?nick:empty_string, ban_it(nick, user, host, (n && n->ip)?n->ip:NULL)); if (f**k) { malloc_sprintf(&str, "%s!*%s@%s %s 3 Auto-Shit", nick, user, host, channel); #ifdef WANT_USERLIST add_shit(NULL, str, NULL, NULL); #endif new_free(&str); } else if (set_ignore) ignore_nickname(ban_it("*", user, host, NULL) , IGNORE_ALL, 0); new_free(&user); }
/* * SHIT <channel|*> <nick|mask> <action> [expire] <reason> */ void do_shit(COMMAND_ARGS) { /* * on_msg checks CARGS */ char *channel,*nick,*nuh; int shitlevel,days,uaccess,shitaccess; if (CurrentCmd->name == C_QSHIT) { channel = MATCH_ALL; } else { channel = chop(&rest); if (!ischannel(channel) && *channel != '*') { usage: usage(from); /* usage for CurrentCmd->name */ return; } } if ((uaccess = get_useraccess(from,channel)) < cmdaccess) return; if ((nick = chop(&rest)) == NULL) goto usage; if (CurrentCmd->name == C_QSHIT) { shitlevel = DEFAULTSHITLEVEL; days = 86400 * DEFAULTSHITLENGTH; if (*rest == 0) rest = TEXT_DEFAULTSHIT; } else { shitlevel = asc2int(chop(&rest)); if (errno) goto usage; if (shitlevel < 1 || shitlevel > MAXSHITLEVEL) { to_user(from,"Valid levels are from 1 thru " MAXSHITLEVELSTRING); return; } /* * option: expire in XXX days */ days = 86400 * 30; if (*rest >= '1' && *rest <= '9') { days = 86400 * asc2int(chop(&rest)); if (errno) goto usage; } if (*rest == 0) goto usage; } #ifdef CHANBAN if (shitlevel == SHIT_CHANBAN) { nuh = nick; } else #endif /* CHANBAN */ { if ((nuh = nick2uh(from,nick)) == NULL) return; if (find_shit(nuh,channel)) { to_user(from,TEXT_ALREADYSHITTED,nuh); return; } if (uaccess != OWNERLEVEL) { shitaccess = get_useraccess(nuh,channel); if (shitaccess > uaccess) { to_user(from,TEXT_SHITLOWACCESS,nuh); return; } } format_uh(nuh,FUH_USERHOST); } #ifdef DEBUG debug("(do_shit) adding %s to %s (Level %i)\n",nuh,channel,shitlevel); #endif /* DEBUG */ add_shit(from,channel,nuh,rest,shitlevel,now + days); to_user(from,TEXT_HASSHITTED,nuh,channel); to_user(from,TEXT_SHITEXPIRES,time2str(now + days)); check_shit(); }