diff options
author | James Booth <boothj5@gmail.com> | 2012-12-01 17:46:25 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-12-01 17:46:25 +0000 |
commit | fae848ea64dfb5f10f5f76e6c8f71d0fa202fcba (patch) | |
tree | 6e565510bc03cf797bd134b5be182471be71c4ec /src/profanity.c | |
parent | f7d0bcba4c4d4132104ed84273e8a3bf7c8ce2a5 (diff) | |
download | profani-tty-fae848ea64dfb5f10f5f76e6c8f71d0fa202fcba.tar.gz |
Implemented /autoaway mode idle
Diffstat (limited to 'src/profanity.c')
-rw-r--r-- | src/profanity.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/profanity.c b/src/profanity.c index 27fea803..75df9f8e 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -452,8 +452,10 @@ _handle_idle_time() if (!idle) { if (idle_ms >= prefs_time) { idle = TRUE; + + // handle away mode if (strcmp(prefs_get_autoaway_mode(), "away") == 0) { - jabber_update_presence(PRESENCE_AWAY, prefs_get_autoaway_message()); + jabber_update_presence(PRESENCE_AWAY, prefs_get_autoaway_message(), 0); if (prefs_get_autoaway_message() != NULL) { cons_show("Idle for %d minutes, status set to away, \"%s\".", prefs_get_autoaway_time(), prefs_get_autoaway_message()); @@ -465,24 +467,28 @@ _handle_idle_time() title_bar_set_status(PRESENCE_AWAY); win_current_page_off(); } + + // handle idle mode } else if (strcmp(prefs_get_autoaway_mode(), "idle") == 0) { - cons_show("IDLE"); - win_current_page_off(); + jabber_update_presence(PRESENCE_ONLINE, + prefs_get_autoaway_message(), idle_ms / 1000); } } } else { if (idle_ms < prefs_time) { idle = FALSE; + + // handle check if (prefs_get_autoaway_check()) { if (strcmp(prefs_get_autoaway_mode(), "away") == 0) { - jabber_update_presence(PRESENCE_ONLINE, NULL); - cons_show("Auto presence online."); + jabber_update_presence(PRESENCE_ONLINE, NULL, 0); + cons_show("No longer idle, status set to online."); title_bar_set_status(PRESENCE_ONLINE); win_current_page_off(); } else if (strcmp(prefs_get_autoaway_mode(), "idle") == 0) { - cons_show("BACK"); - win_current_page_off(); + jabber_update_presence(PRESENCE_ONLINE, NULL, 0); + title_bar_set_status(PRESENCE_ONLINE); } } } |