Cleanup remove_channel()
remove_channel() is only called in direct response to a message from a server, so it always acts on from_server - remove the unnecessary server argument. The channel argument is always non-NULL - remove the dead code that removed all channels if a NULL channel was passed.
This commit is contained in:
@@ -1207,48 +1207,30 @@ void BX_clear_bans(ChannelList *channel)
|
||||
channel->exemptbans = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove_channel: removes the named channel from the
|
||||
* server_list[server].chan_list. If the channel is not on the
|
||||
* server_list[server].chan_list, nothing happens. If the channel was
|
||||
* the current channel, this will select the top of the
|
||||
* server_list[server].chan_list to be the current_channel, or 0 if the
|
||||
* list is empty.
|
||||
/* remove_channel()
|
||||
*
|
||||
* Removes the named channel from the channel list for the current context
|
||||
* server. If the channel was the current channel for a window, this will
|
||||
* select a new current channel if possible.
|
||||
*
|
||||
* Should be called in direct response to a message from the server indicating
|
||||
* that we are no longer on the channel.
|
||||
*/
|
||||
|
||||
void BX_remove_channel (char *channel, int server)
|
||||
void BX_remove_channel(const char *channel)
|
||||
{
|
||||
ChannelList *tmp;
|
||||
int old_from_server = from_server;
|
||||
|
||||
if (channel)
|
||||
if (*channel == '*')
|
||||
return;
|
||||
if ((tmp = lookup_channel(channel, from_server, CHAN_UNLINK)))
|
||||
{
|
||||
if (*channel == '*')
|
||||
return;
|
||||
from_server = server;
|
||||
from_server = old_from_server;
|
||||
if ((tmp = lookup_channel(channel, server, CHAN_UNLINK)))
|
||||
{
|
||||
clear_bans(tmp);
|
||||
clear_channel(tmp);
|
||||
add_to_whowas_chan_buffer(tmp);
|
||||
}
|
||||
if (is_current_channel(channel, server, 1))
|
||||
switch_channels(0, NULL);
|
||||
clear_bans(tmp);
|
||||
clear_channel(tmp);
|
||||
add_to_whowas_chan_buffer(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChannelList *next;
|
||||
if (is_current_channel(channel, from_server, 1))
|
||||
switch_channels(0, NULL);
|
||||
|
||||
for (tmp = get_server_channels(server); tmp; tmp = next)
|
||||
{
|
||||
next = tmp->next;
|
||||
clear_channel(tmp);
|
||||
clear_bans(tmp);
|
||||
add_to_whowas_chan_buffer(tmp);
|
||||
}
|
||||
set_server_channels(server, NULL);
|
||||
}
|
||||
xterm_settitle();
|
||||
update_all_windows();
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ static void not_valid_channel(char *from, char **ArgList)
|
||||
if (!my_stricmp(from, get_server_itsname(from_server)))
|
||||
{
|
||||
if (strcmp(channel, "*"))
|
||||
remove_channel(channel, from_server);
|
||||
remove_channel(channel);
|
||||
put_it("%s", convert_output_format(fget_string_var(FORMAT_SERVER_MSG2_FSET), "%s %s %s", update_clock(GET_TIME), channel, ArgList[1]));
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@ static void cannot_join_channel(char *from, char **ArgList)
|
||||
|
||||
remove_from_join_list(chan, from_server);
|
||||
if (!is_on_channel(chan, from_server, get_server_nickname(from_server)))
|
||||
remove_channel(chan, from_server);
|
||||
remove_channel(chan);
|
||||
else
|
||||
return;
|
||||
|
||||
|
||||
@@ -1719,7 +1719,7 @@ static void p_kick(char *from, char **ArgList)
|
||||
new_free(&chankey);
|
||||
if (do_hook(KICK_LIST, "%s %s %s %s", who, from, channel, comment?comment:empty_string))
|
||||
put_it("%s",convert_output_format(fget_string_var(FORMAT_KICK_USER_FSET),"%s %s %s %s %s",update_clock(GET_TIME),from, channel, who, comment));
|
||||
remove_channel(channel, from_server);
|
||||
remove_channel(channel);
|
||||
update_all_status(window ? window : current_window, NULL, 0);
|
||||
update_input(UPDATE_ALL);
|
||||
logmsg(LOG_KICK_USER, from, 0, "%s %s %s %s", FromUserHost, who, channel, comment);
|
||||
@@ -1784,7 +1784,7 @@ static void p_part(char *from, char **ArgList)
|
||||
put_it("%s",convert_output_format(fget_string_var(FORMAT_LEAVE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost, channel, ArgList[1]?ArgList[1]:empty_string));
|
||||
if (!my_stricmp(from, get_server_nickname(from_server)))
|
||||
{
|
||||
remove_channel(channel, from_server);
|
||||
remove_channel(channel);
|
||||
remove_from_mode_list(channel, from_server);
|
||||
remove_from_join_list(channel, from_server);
|
||||
set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0);
|
||||
|
||||
Reference in New Issue
Block a user