summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-01-04 17:28:26 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-01-04 17:28:26 +0000
commitd844880515cca4f0f3984b3d9de71c0b168b647b (patch)
tree08919043ca016131fe1e844b3b614df19d61018c
parentf3f80c14991779433c9a1eb13554d846a33205c6 (diff)
downloadirssi-d844880515cca4f0f3984b3d9de71c0b168b647b.zip
/UNBAN <ref#> works. /BAN list shows reference numbers.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1062 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/irc/fe-irc-commands.c8
-rw-r--r--src/fe-common/irc/module-formats.c4
-rw-r--r--src/irc/core/bans.c14
3 files changed, 21 insertions, 5 deletions
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index c6fae677..252b568d 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -188,6 +188,10 @@ static void bans_ask_channel(const char *channel, IRC_SERVER_REC *server,
static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
{
GSList *tmp;
+ int counter;
+
+ if (!channel->synced)
+ cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
if (channel->banlist == NULL && channel->ebanlist == NULL) {
printformat(server, channel->name, MSGLEVEL_CRAP,
@@ -196,14 +200,16 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
}
/* show bans.. */
+ counter = 1;
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
BAN_REC *rec = tmp->data;
printformat(server, channel->name, MSGLEVEL_CRAP,
(rec->setby == NULL || *rec->setby == '\0') ?
IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
- channel->name, rec->ban, rec->setby,
+ counter, channel->name, rec->ban, rec->setby,
(int) (time(NULL)-rec->time));
+ counter++;
}
/* ..and show ban exceptions.. */
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index e5fd8c53..cc55f231 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -72,8 +72,8 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "channel_mode", "mode/{channelhilight $0} {mode $1}", 2, { 0, 0 } },
{ "bantype", "Ban type changed to {channel $0}", 1, { 0 } },
{ "no_bans", "No bans in channel {channel $0}", 1, { 0 } },
- { "banlist", "{channel $0}: ban {ban $1}", 2, { 0, 0 } },
- { "banlist_long", "{channel $0}: ban {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
+ { "banlist", "$0 - {channel $1}: ban {ban $2}", 3, { 1, 0, 0 } },
+ { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, $4 secs ago}", 5, { 1, 0, 0, 0, 1 } },
{ "ebanlist", "{channel $0}: ban exception {ban $1}", 2, { 0, 0 } },
{ "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
{ "invitelist", "{channel $0}: invite {ban $1}", 2, { 0, 0 } },
diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c
index 947f3d69..5cd6a6e1 100644
--- a/src/irc/core/bans.c
+++ b/src/irc/core/bans.c
@@ -176,7 +176,8 @@ void ban_remove(IRC_CHANNEL_REC *channel, const char *bans)
g_string_free(str, TRUE);
}
-static void command_set_ban(const char *data, IRC_SERVER_REC *server, void *item, int set)
+static void command_set_ban(const char *data, IRC_SERVER_REC *server,
+ WI_ITEM_REC *item, int set)
{
IRC_CHANNEL_REC *chanrec;
char *channel, *nicks;
@@ -204,8 +205,17 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server, void *item
if (set)
ban_set(chanrec, nicks);
- else
+ 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;
+ }
+
ban_remove(chanrec, nicks);
+ }
cmd_params_free(free_arg);
}