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:
parent
6fe433ca0b
commit
3ddd984bfc
@ -211,9 +211,6 @@ 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) {
|
||||
printformat(server, channel->visible_name,
|
||||
MSGLEVEL_CLIENTNOTICE,
|
||||
@ -265,9 +262,9 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server,
|
||||
if (*channel != '\0' && strcmp(channel, "*") != 0)
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
|
||||
if (chanrec == NULL) {
|
||||
/* not joined to such channel,
|
||||
but ask ban lists from server */
|
||||
if (chanrec == NULL || !chanrec->synced) {
|
||||
/* not joined to such channel or not yet synced,
|
||||
ask ban lists from server */
|
||||
bans_ask_channel(channel, server, item);
|
||||
} else {
|
||||
bans_show_channel(chanrec, server);
|
||||
|
@ -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);
|
||||
|
||||
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)
|
||||
ban_type = default_ban_type;
|
||||
@ -158,6 +162,8 @@ void ban_remove(IRC_CHANNEL_REC *channel, const char *bans)
|
||||
}
|
||||
if (rec != NULL)
|
||||
g_string_sprintfa(str, "%s ", rec->ban);
|
||||
else if (!channel->synced)
|
||||
g_warning("channel %s is not synced", channel->name);
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (chanrec == NULL)
|
||||
cmd_param_error(CMDERR_CHAN_NOT_FOUND);
|
||||
if (!chanrec->wholist)
|
||||
cmd_param_error(CMDERR_CHAN_NOT_SYNCED);
|
||||
|
||||
if (set)
|
||||
ban_set(chanrec, nicks, ban_type);
|
||||
|
@ -682,8 +682,6 @@ static void cmd_kickban(const char *data, IRC_SERVER_REC *server,
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
if (chanrec == NULL)
|
||||
cmd_param_error(CMDERR_CHAN_NOT_FOUND);
|
||||
if (!chanrec->wholist)
|
||||
cmd_param_error(CMDERR_CHAN_NOT_SYNCED);
|
||||
|
||||
nicklist = g_strsplit(nicks, ",", -1);
|
||||
spacenicks = g_strjoinv(" ", nicklist);
|
||||
@ -761,8 +759,6 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
if (!IS_IRC_CHANNEL(channel))
|
||||
cmd_return_error(CMDERR_NOT_JOINED);
|
||||
if (!channel->wholist)
|
||||
cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
|
||||
|
||||
if (i_isdigit(*data)) {
|
||||
/* first argument is the timeout */
|
||||
|
Loading…
Reference in New Issue
Block a user