diff options
author | James Booth <boothj5@gmail.com> | 2015-09-25 22:55:44 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-09-25 22:55:44 +0100 |
commit | 100db7c36cc40ff740a51d51c2c7887c4d2e138d (patch) | |
tree | 91b5f7a7d1e6d05c8b45f78928e596d8378a0d02 /src/profanity.c | |
parent | 22ba3db0b27a34f62594adaab4519c854ee72f77 (diff) | |
download | profani-tty-100db7c36cc40ff740a51d51c2c7887c4d2e138d.tar.gz |
Set status to what it was before autoaway
Diffstat (limited to 'src/profanity.c')
-rw-r--r-- | src/profanity.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/profanity.c b/src/profanity.c index 1e542420..edc3cf76 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -78,6 +78,8 @@ static void _create_directories(void); static void _connect_default(const char * const account); static gboolean idle = FALSE; +resource_presence_t autoaway_pre_presence; + static gboolean cont = TRUE; void @@ -174,8 +176,10 @@ _check_autoaway() unsigned long idle_ms = ui_get_idle_time(); char *pref_autoaway_mode = prefs_get_string(PREF_AUTOAWAY_MODE); + if (!idle) { resource_presence_t current_presence = accounts_get_last_presence(jabber_get_account_name()); + autoaway_pre_presence = current_presence; if ((current_presence == RESOURCE_ONLINE) || (current_presence == RESOURCE_CHAT)) { if (idle_ms >= prefs_time) { idle = TRUE; @@ -202,11 +206,11 @@ _check_autoaway() // handle check if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) { if (strcmp(pref_autoaway_mode, "away") == 0) { - cl_ev_presence_send(RESOURCE_ONLINE, NULL, 0); - ui_end_auto_away(); + cl_ev_presence_send(autoaway_pre_presence, NULL, 0); + ui_end_auto_away(autoaway_pre_presence); } else if (strcmp(pref_autoaway_mode, "idle") == 0) { - cl_ev_presence_send(RESOURCE_ONLINE, NULL, 0); - ui_titlebar_presence(CONTACT_ONLINE); + cl_ev_presence_send(autoaway_pre_presence, NULL, 0); + ui_titlebar_presence(contact_presence_from_resource_presence(autoaway_pre_presence)); } } } |