diff options
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r-- | src/fe-common/irc/dcc/fe-dcc.c | 1 | ||||
-rw-r--r-- | src/fe-common/irc/fe-channels.c | 12 | ||||
-rw-r--r-- | src/fe-common/irc/fe-query.c | 12 |
3 files changed, 21 insertions, 4 deletions
diff --git a/src/fe-common/irc/dcc/fe-dcc.c b/src/fe-common/irc/dcc/fe-dcc.c index 0bc08fb9..077fb5f7 100644 --- a/src/fe-common/irc/dcc/fe-dcc.c +++ b/src/fe-common/irc/dcc/fe-dcc.c @@ -264,6 +264,7 @@ static void sig_dcc_destroyed(DCC_REC *dcc) if (query != NULL) { /* DCC chat closed, close the query with it. */ + if (dcc->connection_lost) query->unwanted = TRUE; query_destroy(query); } } diff --git a/src/fe-common/irc/fe-channels.c b/src/fe-common/irc/fe-channels.c index b38db164..7cf4f5eb 100644 --- a/src/fe-common/irc/fe-channels.c +++ b/src/fe-common/irc/fe-channels.c @@ -25,6 +25,7 @@ #include "commands.h" #include "levels.h" #include "misc.h" +#include "settings.h" #include "irc.h" #include "channels.h" @@ -54,7 +55,14 @@ 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_remove_item(window, (WI_ITEM_REC *) channel); + if (window != NULL) { + window_remove_item(window, (WI_ITEM_REC *) channel); + + if (windows->next != NULL && (!channel->joined || channel->left) && + settings_get_bool("window_close_on_part")) { + window_destroy(window); + } + } } static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item) @@ -235,6 +243,8 @@ static void cmd_channel_remove(const char *data) void fe_channels_init(void) { + settings_add_bool("lookandfeel", "window_close_on_part", TRUE); + signal_add("channel created", (SIGNAL_FUNC) signal_channel_created); signal_add("channel destroyed", (SIGNAL_FUNC) signal_channel_destroyed); signal_add("window item remove", (SIGNAL_FUNC) signal_window_item_removed); diff --git a/src/fe-common/irc/fe-query.c b/src/fe-common/irc/fe-query.c index d93ae114..c87f7998 100644 --- a/src/fe-common/irc/fe-query.c +++ b/src/fe-common/irc/fe-query.c @@ -68,7 +68,13 @@ static void signal_query_destroyed(QUERY_REC *query) g_return_if_fail(query != NULL); window = window_item_window((WI_ITEM_REC *) query); - if (window != NULL) window_remove_item(window, (WI_ITEM_REC *) query); + if (window != NULL) { + window_remove_item(window, (WI_ITEM_REC *) query); + + if (windows->next != NULL && !query->unwanted && + settings_get_bool("window_close_on_part")) + window_destroy(window); + } } static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item) @@ -78,7 +84,7 @@ static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item) g_return_if_fail(window != NULL); query = irc_item_query(item); - if (query != NULL) query_destroy(query); + if (query != NULL) query_destroy(query); } static void sig_server_connected(IRC_SERVER_REC *server) @@ -169,7 +175,7 @@ static int sig_query_autoclose(void) window = window_item_window((WI_ITEM_REC *) rec); if (window != active_win && rec->new_data == 0 && now-window->last_line > query_auto_close) - query_destroy(rec); + query_destroy(rec); } return 1; } |