mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
When server is disconnected, change to use some other server in windows
where the server was active, instead of just setting the server to NULL. Ctrl-X didn't work right if there was no active server in window. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@574 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
8209e131d9
commit
bcd7b636ed
@ -382,14 +382,16 @@ static void sig_server_looking(void *server)
|
||||
static void sig_server_disconnected(void *server)
|
||||
{
|
||||
GSList *tmp;
|
||||
SERVER_REC *new_server;
|
||||
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
new_server = servers == NULL ? NULL : servers->data;
|
||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||
WINDOW_REC *rec = tmp->data;
|
||||
|
||||
if (rec->active_server == server)
|
||||
window_change_server(rec, NULL);
|
||||
window_change_server(rec, new_server);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,10 +451,14 @@ static void key_previous_window_item(void)
|
||||
|
||||
if (active_win->items != NULL)
|
||||
signal_emit("command window item prev", 3, "", active_win->active_server, active_win->active);
|
||||
else if (active_win->active_server != NULL) {
|
||||
else if (servers != NULL) {
|
||||
/* change server */
|
||||
pos = g_slist_find(servers, active_win->active_server);
|
||||
server = pos->next != NULL ? pos->next->data : servers->data;
|
||||
if (active_win->active_server == NULL)
|
||||
server = servers->data;
|
||||
else {
|
||||
pos = g_slist_find(servers, active_win->active_server);
|
||||
server = pos->next != NULL ? pos->next->data : servers->data;
|
||||
}
|
||||
signal_emit("command window server", 3, server->tag, active_win->active_server, active_win->active);
|
||||
}
|
||||
}
|
||||
@ -466,11 +470,15 @@ static void key_next_window_item(void)
|
||||
|
||||
if (active_win->items != NULL)
|
||||
signal_emit("command window item next", 3, "", active_win->active_server, active_win->active);
|
||||
else if (active_win->active_server != NULL) {
|
||||
else if (servers != NULL) {
|
||||
/* change server */
|
||||
index = g_slist_index(servers, active_win->active_server);
|
||||
server = index > 0 ? g_slist_nth(servers, index-1)->data :
|
||||
g_slist_last(servers)->data;
|
||||
if (active_win->active_server == NULL)
|
||||
server = servers->data;
|
||||
else {
|
||||
index = g_slist_index(servers, active_win->active_server);
|
||||
server = index > 0 ? g_slist_nth(servers, index-1)->data :
|
||||
g_slist_last(servers)->data;
|
||||
}
|
||||
signal_emit("command window server", 3, server->tag, active_win->active_server, active_win->active);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user