summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-05-14 17:35:24 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-05-14 17:35:24 +0000
commit27ceadbff36088a47d48e7417b69f26dbc44d3f9 (patch)
treeadc9652ea20bf1c33140912fed231beaf1bd0a87 /src/irc
parente792c23d5492a3f485a0b3f43a9808e1d43cee78 (diff)
downloadirssi-27ceadbff36088a47d48e7417b69f26dbc44d3f9.zip
/UNBAN now supports unbanning multiple bans with ban# (/unban 1 4 6)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1496 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/bans.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c
index 0932f640..96fe0673 100644
--- a/src/irc/core/bans.c
+++ b/src/irc/core/bans.c
@@ -117,16 +117,28 @@ void ban_remove(IRC_CHANNEL_REC *channel, const char *bans)
GString *str;
GSList *tmp;
char **ban, **banlist;
+ int found;
g_return_if_fail(bans != NULL);
str = g_string_new(NULL);
banlist = g_strsplit(bans, " ", -1);
for (ban = banlist; *ban != NULL; ban++) {
+ found = FALSE;
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
BAN_REC *rec = tmp->data;
- if (match_wildcards(*ban, rec->ban))
+ if (match_wildcards(*ban, rec->ban)) {
+ g_string_sprintfa(str, "%s ", rec->ban);
+ found = TRUE;
+ }
+ }
+
+ if (!found && is_numeric(*ban, '\0')) {
+ /* unbanning with ban# */
+ BAN_REC *rec = g_slist_nth_data(channel->banlist,
+ atoi(*ban)-1);
+ if (rec != NULL)
g_string_sprintfa(str, "%s ", rec->ban);
}
}
@@ -167,17 +179,8 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server,
if (set)
ban_set(chanrec, nicks, ban_type);
- else {
- if (is_numeric(nicks, '\0')) {
- /* unban with ban number */
- BAN_REC *ban = g_slist_nth_data(chanrec->banlist,
- atoi(nicks)-1);
- if (ban != NULL)
- nicks = ban->ban;
- }
-
+ else
ban_remove(chanrec, nicks);
- }
cmd_params_free(free_arg);
}