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:
@@ -427,7 +427,7 @@ extern Function_ptr *global;
|
|||||||
#define get_channel_bans (*(char *(*)(char *, int , int ))global[GET_CHANNEL_BANS])
|
#define get_channel_bans (*(char *(*)(char *, int , int ))global[GET_CHANNEL_BANS])
|
||||||
#define get_channel_mode (*(char *(*)(char *, int ))global[GET_CHANNEL_MODE])
|
#define get_channel_mode (*(char *(*)(char *, int ))global[GET_CHANNEL_MODE])
|
||||||
#define clear_bans (*(void (*)(ChannelList *))global[CLEAR_BANS])
|
#define clear_bans (*(void (*)(ChannelList *))global[CLEAR_BANS])
|
||||||
#define remove_channel (*(void (*)(char *, int ))global[REMOVE_CHANNEL])
|
#define remove_channel (*(void (*)(const char *))global[REMOVE_CHANNEL])
|
||||||
#define remove_from_channel (*(void (*)(char *, char *, int , int , char *))global[REMOVE_FROM_CHANNEL])
|
#define remove_from_channel (*(void (*)(char *, char *, int , int , char *))global[REMOVE_FROM_CHANNEL])
|
||||||
#define rename_nick (*(void (*)(char *, char *, int ))global[RENAME_NICK])
|
#define rename_nick (*(void (*)(char *, char *, int ))global[RENAME_NICK])
|
||||||
#define get_channel_oper (*(int (*)(char *, int ))global[GET_CHANNEL_OPER])
|
#define get_channel_oper (*(int (*)(char *, int ))global[GET_CHANNEL_OPER])
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void set_channel_mode (char *, int, char *);
|
|||||||
#endif /* INCLUDE_UNUSED_FUNCTIONS */
|
#endif /* INCLUDE_UNUSED_FUNCTIONS */
|
||||||
ChannelList * BX_add_channel (char *, int, int);
|
ChannelList * BX_add_channel (char *, int, int);
|
||||||
ChannelList * BX_add_to_channel (char *, char *, int, int, int, char *, char *, char *, int, int);
|
ChannelList * BX_add_to_channel (char *, char *, int, int, int, char *, char *, char *, int, int);
|
||||||
void BX_remove_channel (char *, int);
|
void BX_remove_channel (const char *);
|
||||||
void BX_remove_from_channel (char *, char *, int, int, char *);
|
void BX_remove_from_channel (char *, char *, int, int, char *);
|
||||||
int BX_is_on_channel (char *, int, char *);
|
int BX_is_on_channel (char *, int, char *);
|
||||||
void list_channels (void);
|
void list_channels (void);
|
||||||
|
|||||||
@@ -1207,48 +1207,30 @@ void BX_clear_bans(ChannelList *channel)
|
|||||||
channel->exemptbans = NULL;
|
channel->exemptbans = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* remove_channel()
|
||||||
* remove_channel: removes the named channel from the
|
*
|
||||||
* server_list[server].chan_list. If the channel is not on the
|
* Removes the named channel from the channel list for the current context
|
||||||
* server_list[server].chan_list, nothing happens. If the channel was
|
* server. If the channel was the current channel for a window, this will
|
||||||
* the current channel, this will select the top of the
|
* select a new current channel if possible.
|
||||||
* server_list[server].chan_list to be the current_channel, or 0 if the
|
*
|
||||||
* list is empty.
|
* 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(const char *channel)
|
||||||
void BX_remove_channel (char *channel, int server)
|
|
||||||
{
|
{
|
||||||
ChannelList *tmp;
|
ChannelList *tmp;
|
||||||
int old_from_server = from_server;
|
|
||||||
|
|
||||||
if (channel)
|
|
||||||
{
|
|
||||||
if (*channel == '*')
|
if (*channel == '*')
|
||||||
return;
|
return;
|
||||||
from_server = server;
|
if ((tmp = lookup_channel(channel, from_server, CHAN_UNLINK)))
|
||||||
from_server = old_from_server;
|
|
||||||
if ((tmp = lookup_channel(channel, server, CHAN_UNLINK)))
|
|
||||||
{
|
{
|
||||||
clear_bans(tmp);
|
clear_bans(tmp);
|
||||||
clear_channel(tmp);
|
clear_channel(tmp);
|
||||||
add_to_whowas_chan_buffer(tmp);
|
add_to_whowas_chan_buffer(tmp);
|
||||||
}
|
}
|
||||||
if (is_current_channel(channel, server, 1))
|
if (is_current_channel(channel, from_server, 1))
|
||||||
switch_channels(0, NULL);
|
switch_channels(0, NULL);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChannelList *next;
|
|
||||||
|
|
||||||
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();
|
xterm_settitle();
|
||||||
update_all_windows();
|
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 (!my_stricmp(from, get_server_itsname(from_server)))
|
||||||
{
|
{
|
||||||
if (strcmp(channel, "*"))
|
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]));
|
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);
|
remove_from_join_list(chan, from_server);
|
||||||
if (!is_on_channel(chan, from_server, get_server_nickname(from_server)))
|
if (!is_on_channel(chan, from_server, get_server_nickname(from_server)))
|
||||||
remove_channel(chan, from_server);
|
remove_channel(chan);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1719,7 +1719,7 @@ static void p_kick(char *from, char **ArgList)
|
|||||||
new_free(&chankey);
|
new_free(&chankey);
|
||||||
if (do_hook(KICK_LIST, "%s %s %s %s", who, from, channel, comment?comment:empty_string))
|
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));
|
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_all_status(window ? window : current_window, NULL, 0);
|
||||||
update_input(UPDATE_ALL);
|
update_input(UPDATE_ALL);
|
||||||
logmsg(LOG_KICK_USER, from, 0, "%s %s %s %s", FromUserHost, who, channel, comment);
|
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));
|
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)))
|
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_mode_list(channel, from_server);
|
||||||
remove_from_join_list(channel, from_server);
|
remove_from_join_list(channel, from_server);
|
||||||
set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0);
|
set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user