Improve the list_channels() function so that it behaves correctly when
connected to multiple servers. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@285 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2c01]
|
[Changes 1.2c01]
|
||||||
|
|
||||||
|
* Improve the list_channels() function. (caf)
|
||||||
|
|
||||||
* Use socklen_t instead of plain int where available. (flashback)
|
* Use socklen_t instead of plain int where available. (flashback)
|
||||||
|
|
||||||
* Use <termios.h> in preference to <sys/termios.h> where it's available. (caf)
|
* Use <termios.h> in preference to <sys/termios.h> where it's available. (caf)
|
||||||
|
|||||||
@@ -1491,35 +1491,35 @@ static void show_channel(ChannelList *chan)
|
|||||||
void list_channels(void)
|
void list_channels(void)
|
||||||
{
|
{
|
||||||
ChannelList *tmp;
|
ChannelList *tmp;
|
||||||
int server,
|
int server;
|
||||||
no = 1;
|
int shown_current = 0;
|
||||||
|
int shown_others = 0;
|
||||||
|
|
||||||
if (get_server_channels(from_server))
|
|
||||||
{
|
|
||||||
if (get_current_channel_by_refnum(0))
|
if (get_current_channel_by_refnum(0))
|
||||||
say("Current channel %s", get_current_channel_by_refnum(0));
|
say("Current channel %s", get_current_channel_by_refnum(0));
|
||||||
else
|
else
|
||||||
say("No current channel for this window");
|
say("No current channel for this window");
|
||||||
if ((tmp = get_server_channels(get_window_server(0))))
|
|
||||||
|
for (tmp = get_server_channels(get_window_server(0)); tmp; tmp = tmp->next)
|
||||||
{
|
{
|
||||||
for (; tmp; tmp = tmp->next)
|
|
||||||
show_channel(tmp);
|
show_channel(tmp);
|
||||||
no = 0;
|
shown_current = 1;
|
||||||
}
|
}
|
||||||
if (connected_to_server != 1)
|
|
||||||
{
|
|
||||||
for (server = 0; server < server_list_size(); server++)
|
for (server = 0; server < server_list_size(); server++)
|
||||||
{
|
{
|
||||||
if (server == get_window_server(0))
|
if (server == get_window_server(0))
|
||||||
continue;
|
continue;
|
||||||
say("Other servers:");
|
|
||||||
for (tmp = get_server_channels(server); tmp; tmp = tmp->next)
|
for (tmp = get_server_channels(server); tmp; tmp = tmp->next)
|
||||||
|
{
|
||||||
|
if (!shown_others)
|
||||||
|
say("Other servers:");
|
||||||
show_channel(tmp);
|
show_channel(tmp);
|
||||||
no = 0;
|
shown_others = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
if (!shown_current && !shown_others)
|
||||||
say("You are not on any channels");
|
say("You are not on any channels");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user