1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

/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
This commit is contained in:
Timo Sirainen 2002-03-10 14:24:08 +00:00 committed by cras
parent b67e363cde
commit 9293d23da2
2 changed files with 22 additions and 19 deletions

View File

@ -4,6 +4,8 @@
char *address; char *address;
char *server_tag; char *server_tag;
time_t last_unread_msg;
unsigned int unwanted:1; /* TRUE if the other side closed or unsigned int unwanted:1; /* TRUE if the other side closed or
some error occured (DCC chats!) */ some error occured (DCC chats!) */
unsigned int destroying:1; unsigned int destroying:1;

View File

@ -275,32 +275,28 @@ static void cmd_query(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
cmd_params_free(free_arg); cmd_params_free(free_arg);
} }
static int window_has_query(WINDOW_REC *window) static void window_reset_query_timestamps(WINDOW_REC *window)
{ {
GSList *tmp; GSList *tmp;
g_return_val_if_fail(window != NULL, FALSE); if (window == NULL)
return;
for (tmp = window->items; tmp != NULL; tmp = tmp->next) { for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
if (IS_QUERY(tmp->data)) QUERY_REC *query = QUERY(tmp->data);
return TRUE;
}
return FALSE; if (query != NULL)
query->last_unread_msg = time(NULL);
}
} }
static void sig_window_changed(WINDOW_REC *window, WINDOW_REC *old_window) static void sig_window_changed(WINDOW_REC *window, WINDOW_REC *old_window)
{ {
if (query_auto_close <= 0) /* reset the queries last_unread_msg so query doesn't get closed
return; immediately after switched to the window, or after changed to
some other window from it */
/* reset the window's last_line timestamp so that query doesn't get window_reset_query_timestamps(window);
closed immediately after switched to the window, or after changed window_reset_query_timestamps(old_window);
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);
} }
static int sig_query_autoclose(void) static int sig_query_autoclose(void)
@ -315,8 +311,8 @@ static int sig_query_autoclose(void)
next = tmp->next; next = tmp->next;
window = window_item_window((WI_ITEM_REC *) rec); window = window_item_window((WI_ITEM_REC *) rec);
if (window != active_win && rec->data_level == 0 && if (window != active_win && rec->data_level < DATA_LEVEL_MSG &&
now-window->last_line > query_auto_close) now-rec->last_unread_msg > query_auto_close)
query_destroy(rec); query_destroy(rec);
} }
return 1; return 1;
@ -325,8 +321,13 @@ static int sig_query_autoclose(void)
static void sig_message_private(SERVER_REC *server, const char *msg, static void sig_message_private(SERVER_REC *server, const char *msg,
const char *nick, const char *address) const char *nick, const char *address)
{ {
QUERY_REC *query;
/* create query window if needed */ /* 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) static void read_settings(void)