summaryrefslogtreecommitdiff
path: root/src/fe-common/core/fe-queries.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-03-10 14:24:08 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-03-10 14:24:08 +0000
commit9293d23da20517037f1c9ba437a5faf1bf6c8e45 (patch)
tree28eaa61830cb42268d4bcc6f085d27beac713fee /src/fe-common/core/fe-queries.c
parentb67e363cde8e0e4ce49e6d3bfc6ba1cd4b2ca1fe (diff)
downloadirssi-9293d23da20517037f1c9ba437a5faf1bf6c8e45.zip
/SET autoclose_query - now only last received private message affects when
the query is closed, ie. /WHOIS requests or nick changes don't reset the counter. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2549 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/fe-queries.c')
-rw-r--r--src/fe-common/core/fe-queries.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c
index 44d7ef01..c7e83bfe 100644
--- a/src/fe-common/core/fe-queries.c
+++ b/src/fe-common/core/fe-queries.c
@@ -275,32 +275,28 @@ static void cmd_query(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
cmd_params_free(free_arg);
}
-static int window_has_query(WINDOW_REC *window)
+static void window_reset_query_timestamps(WINDOW_REC *window)
{
GSList *tmp;
- g_return_val_if_fail(window != NULL, FALSE);
+ if (window == NULL)
+ return;
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
- if (IS_QUERY(tmp->data))
- return TRUE;
- }
+ QUERY_REC *query = QUERY(tmp->data);
- return FALSE;
+ if (query != NULL)
+ query->last_unread_msg = time(NULL);
+ }
}
static void sig_window_changed(WINDOW_REC *window, WINDOW_REC *old_window)
{
- if (query_auto_close <= 0)
- return;
-
- /* reset the window's last_line timestamp so that query doesn't get
- closed immediately after switched to the window, or after changed
- to some other window from it */
- if (window != NULL && window_has_query(window))
- window->last_line = time(NULL);
- if (old_window != NULL && window_has_query(old_window))
- old_window->last_line = time(NULL);
+ /* reset the queries last_unread_msg so query doesn't get closed
+ immediately after switched to the window, or after changed to
+ some other window from it */
+ window_reset_query_timestamps(window);
+ window_reset_query_timestamps(old_window);
}
static int sig_query_autoclose(void)
@@ -315,8 +311,8 @@ static int sig_query_autoclose(void)
next = tmp->next;
window = window_item_window((WI_ITEM_REC *) rec);
- if (window != active_win && rec->data_level == 0 &&
- now-window->last_line > query_auto_close)
+ if (window != active_win && rec->data_level < DATA_LEVEL_MSG &&
+ now-rec->last_unread_msg > query_auto_close)
query_destroy(rec);
}
return 1;
@@ -325,8 +321,13 @@ static int sig_query_autoclose(void)
static void sig_message_private(SERVER_REC *server, const char *msg,
const char *nick, const char *address)
{
+ QUERY_REC *query;
+
/* create query window if needed */
- privmsg_get_query(server, nick, FALSE, MSGLEVEL_MSGS);
+ query = privmsg_get_query(server, nick, FALSE, MSGLEVEL_MSGS);
+
+ /* reset the query's last_unread_msg timestamp */
+ query->last_unread_msg = time(NULL);
}
static void read_settings(void)