mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
/UNBAN <ref#> works. /BAN list shows reference numbers.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1062 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
f3f80c1499
commit
d844880515
@ -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.. */
|
||||
|
@ -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 } },
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user