diff options
author | Timo Sirainen <cras@irssi.org> | 2000-06-01 17:22:17 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-06-01 17:22:17 +0000 |
commit | f741a73ad4e46e912dc95d486b6ddbb3ad738e65 (patch) | |
tree | da9b3418771d839470108cd5088af2b36258c723 /src | |
parent | 4dd5c50390534a2f4796738b7ed68c853ff0e8e3 (diff) | |
download | irssi-f741a73ad4e46e912dc95d486b6ddbb3ad738e65.zip |
/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
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/core/bans.c | 16 |
1 files changed, 12 insertions, 4 deletions
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); |