1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Allow /ban, /unban, /kickban, /knockout if channel is not synced.

Requesting ban lists from an unsynced channel will ask
them from the server, banning a user whose u@h irssi
does not know will ban nick!*@* and only bans irssi
knows about can be removed.


git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4925 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Jilles Tjoelker 2008-11-28 20:43:59 +00:00 committed by jilles
parent 6fe433ca0b
commit 3ddd984bfc
3 changed files with 10 additions and 13 deletions

View File

@ -211,9 +211,6 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
GSList *tmp; GSList *tmp;
int counter; int counter;
if (!channel->synced)
cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
if (channel->banlist == NULL) { if (channel->banlist == NULL) {
printformat(server, channel->visible_name, printformat(server, channel->visible_name,
MSGLEVEL_CLIENTNOTICE, MSGLEVEL_CLIENTNOTICE,
@ -265,9 +262,9 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server,
if (*channel != '\0' && strcmp(channel, "*") != 0) if (*channel != '\0' && strcmp(channel, "*") != 0)
chanrec = irc_channel_find(server, channel); chanrec = irc_channel_find(server, channel);
if (chanrec == NULL) { if (chanrec == NULL || !chanrec->synced) {
/* not joined to such channel, /* not joined to such channel or not yet synced,
but ask ban lists from server */ ask ban lists from server */
bans_ask_channel(channel, server, item); bans_ask_channel(channel, server, item);
} else { } else {
bans_show_channel(chanrec, server); bans_show_channel(chanrec, server);

View File

@ -51,7 +51,11 @@ char *ban_get_mask(IRC_CHANNEL_REC *channel, const char *nick, int ban_type)
g_return_val_if_fail(nick != NULL, NULL); g_return_val_if_fail(nick != NULL, NULL);
rec = nicklist_find(CHANNEL(channel), nick); rec = nicklist_find(CHANNEL(channel), nick);
if (rec == NULL || rec->host == NULL) return NULL; if (rec == NULL) return NULL;
if (rec->host == NULL) {
g_warning("channel %s is not synced, using nick ban for %s", channel->name, nick);
return g_strdup_printf("%s!*@*", nick);
}
if (ban_type <= 0) if (ban_type <= 0)
ban_type = default_ban_type; ban_type = default_ban_type;
@ -158,6 +162,8 @@ void ban_remove(IRC_CHANNEL_REC *channel, const char *bans)
} }
if (rec != NULL) if (rec != NULL)
g_string_sprintfa(str, "%s ", rec->ban); g_string_sprintfa(str, "%s ", rec->ban);
else if (!channel->synced)
g_warning("channel %s is not synced", channel->name);
} }
} }
g_strfreev(banlist); g_strfreev(banlist);
@ -191,8 +197,6 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server,
chanrec = irc_channel_find(server, channel); chanrec = irc_channel_find(server, channel);
if (chanrec == NULL) if (chanrec == NULL)
cmd_param_error(CMDERR_CHAN_NOT_FOUND); cmd_param_error(CMDERR_CHAN_NOT_FOUND);
if (!chanrec->wholist)
cmd_param_error(CMDERR_CHAN_NOT_SYNCED);
if (set) if (set)
ban_set(chanrec, nicks, ban_type); ban_set(chanrec, nicks, ban_type);

View File

@ -682,8 +682,6 @@ static void cmd_kickban(const char *data, IRC_SERVER_REC *server,
chanrec = irc_channel_find(server, channel); chanrec = irc_channel_find(server, channel);
if (chanrec == NULL) if (chanrec == NULL)
cmd_param_error(CMDERR_CHAN_NOT_FOUND); cmd_param_error(CMDERR_CHAN_NOT_FOUND);
if (!chanrec->wholist)
cmd_param_error(CMDERR_CHAN_NOT_SYNCED);
nicklist = g_strsplit(nicks, ",", -1); nicklist = g_strsplit(nicks, ",", -1);
spacenicks = g_strjoinv(" ", nicklist); spacenicks = g_strjoinv(" ", nicklist);
@ -761,8 +759,6 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
if (!IS_IRC_CHANNEL(channel)) if (!IS_IRC_CHANNEL(channel))
cmd_return_error(CMDERR_NOT_JOINED); cmd_return_error(CMDERR_NOT_JOINED);
if (!channel->wholist)
cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
if (i_isdigit(*data)) { if (i_isdigit(*data)) {
/* first argument is the timeout */ /* first argument is the timeout */