From f741a73ad4e46e912dc95d486b6ddbb3ad738e65 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 1 Jun 2000 17:22:17 +0000 Subject: /BAN * and /UNBAN * equals to /BAN * * or /UNBAN * *, so you don't have to write the * twice when banning/unbanning everyone.. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@263 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/bans.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/irc') diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c index 4108f1bd..236f80e5 100644 --- a/src/irc/core/bans.c +++ b/src/irc/core/bans.c @@ -134,8 +134,10 @@ void ban_set(CHANNEL_REC *channel, const char *bans) } g_strfreev(banlist); - g_string_truncate(str, str->len-1); - channel_set_singlemode(channel->server, channel->name, str->str, "+b"); + if (str->len > 0) { + g_string_truncate(str, str->len-1); + channel_set_singlemode(channel->server, channel->name, str->str, "+b"); + } g_string_free(str, TRUE); } @@ -157,7 +159,8 @@ void ban_remove(CHANNEL_REC *channel, const char *bans) } g_strfreev(banlist); - channel_set_singlemode(channel->server, channel->name, str->str, "-b"); + if (str->len > 0) + channel_set_singlemode(channel->server, channel->name, str->str, "-b"); g_string_free(str, TRUE); } @@ -173,7 +176,12 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server, WI_IRC_REC params = cmd_get_params(data, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST, item, &channel, &nicks); if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED); - if (*nicks == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); + if (*nicks == '\0') { + if (strcmp(data, "*") != 0) + cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); + /* /BAN * or /UNBAN * - ban/unban everyone */ + nicks = data; + } chanrec = channel_find(server, channel); if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND); -- cgit v1.2.3