Fix the MKNU command, with suggestions from caf.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@205 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2012-06-07 04:22:17 +00:00
parent 3ed7f68d4e
commit 46cf14c0da

View File

@@ -829,19 +829,14 @@ register NickList *nicks;
BUILT_IN_COMMAND(mknu) BUILT_IN_COMMAND(mknu)
{ {
ChannelList *chan; ChannelList *chan;
register NickList *nicks; NickList *nicks;
char *to = NULL, *rest; char *to = NULL, *rest;
int count; int count;
int server = from_server; int server = from_server;
int kickops;
if (args && (is_channel(args) || !strncmp(args, "* ", 2) || !strcmp(args, "*")))
if (!args || !*args)
to = NULL;
else if (*args == '#' || *args == '&' || !strncmp(args, "* ", 2) ||
!strcmp(args, "*"))
to = next_arg(args, &args); to = next_arg(args, &args);
else
to = NULL;
if (!(chan = prepare_command(&server, to, NEED_OP))) if (!(chan = prepare_command(&server, to, NEED_OP)))
return; return;
@@ -850,14 +845,14 @@ register NickList *nicks;
if (rest && !*rest) if (rest && !*rest)
rest = NULL; rest = NULL;
kickops = get_cset_int_var(chan->csets, KICK_OPS_CSET);
count = 0; count = 0;
for (nicks = next_nicklist(chan, NULL); nicks; nicks = next_nicklist(chan, nicks)) for (nicks = next_nicklist(chan, NULL); nicks; nicks = next_nicklist(chan, nicks))
{ {
if (!nick_isop(nicks) && !isme(nicks->nick)) if (nicks->userlist || (nick_isop(nicks) && !kickops) || isme(nicks->nick))
{ continue;
count++; count++;
send_to_server("KICK %s %s :(non-users) \002%cX002", chan->channel, nicks->nick, rest ? rest : get_reason(nicks->nick, NULL)); send_to_server("KICK %s %s :(non-users) \002%s\002", chan->channel, nicks->nick, rest ? rest : get_reason(nicks->nick, NULL));
}
} }
if (!count) if (!count)
say("No matches for masskick of non-users on %s", chan->channel); say("No matches for masskick of non-users on %s", chan->channel);