mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
Make a temporary window bind if you get kicked from channel. Never
allow any window items to go to windows with sticky binds. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1280 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
13712d83b2
commit
a2a6c7e293
@ -59,14 +59,20 @@ static void signal_channel_destroyed(CHANNEL_REC *channel)
|
||||
g_return_if_fail(channel != NULL);
|
||||
|
||||
window = window_item_window((WI_ITEM_REC *) channel);
|
||||
if (window != NULL) {
|
||||
window_item_destroy((WI_ITEM_REC *) channel);
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
if (window->items == NULL && windows->next != NULL &&
|
||||
(!channel->joined || channel->left) &&
|
||||
settings_get_bool("autoclose_windows")) {
|
||||
window_destroy(window);
|
||||
}
|
||||
window_item_destroy((WI_ITEM_REC *) channel);
|
||||
|
||||
if (channel->joined && !channel->left &&
|
||||
channel->server != NULL) {
|
||||
/* kicked out from channel */
|
||||
window_bind_add(window, channel->server->tag,
|
||||
channel->name);
|
||||
} else if (settings_get_bool("autoclose_windows") &&
|
||||
(!channel->joined || channel->left) &&
|
||||
window->items == NULL && windows->next != NULL) {
|
||||
window_destroy(window);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,6 +224,20 @@ WI_ITEM_REC *window_item_find(void *server, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int window_bind_has_sticky(WINDOW_REC *window)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
for (tmp = window->bound_items; tmp != NULL; tmp = tmp->next) {
|
||||
WINDOW_BIND_REC *rec = tmp->data;
|
||||
|
||||
if (rec->sticky)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void window_item_create(WI_ITEM_REC *item, int automatic)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
@ -242,15 +256,6 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
|
||||
for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
|
||||
WINDOW_REC *rec = tmp->data;
|
||||
|
||||
if (reuse_unused_windows &&
|
||||
rec->items == NULL && rec->level == 0 &&
|
||||
(window == NULL || rec == active_win ||
|
||||
window->bound_items != NULL)) {
|
||||
/* no items in this window,
|
||||
we should probably use it.. */
|
||||
window = rec;
|
||||
}
|
||||
|
||||
/* is item bound to this window? */
|
||||
if (item->server != NULL &&
|
||||
window_bind_find(rec, item->server->tag, item->name)) {
|
||||
@ -258,6 +263,23 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
|
||||
clear_waiting = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* use this window IF:
|
||||
- reuse_unused_windows is ON
|
||||
- window has no existing items
|
||||
- window has no level
|
||||
- window has no sticky binds (/LAYOUT SAVEd)
|
||||
- we already haven't found "good enough" window,
|
||||
except if
|
||||
- this is the active window
|
||||
- old window had some temporary bounds and this
|
||||
one doesn't
|
||||
*/
|
||||
if (reuse_unused_windows && rec->items == NULL &&
|
||||
rec->level == 0 && !window_bind_has_sticky(rec) &&
|
||||
(window == NULL || rec == active_win ||
|
||||
window->bound_items != NULL))
|
||||
window = rec;
|
||||
}
|
||||
g_slist_free(sorted);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user