about summary refs log tree commit diff stats
path: root/src/profanity.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-10-07 00:51:00 +0100
committerJames Booth <boothj5@gmail.com>2013-10-07 00:51:00 +0100
commitacf1afe02538d51b7b613b75334c824e2d314cf4 (patch)
tree06564a2f2709cfc23747bbd77942d3dcb7b3a1be /src/profanity.c
parent383d91ec36b7b4afad79dffe2049dabbe2ec93fa (diff)
downloadprofani-tty-acf1afe02538d51b7b613b75334c824e2d314cf4.tar.gz
Moved idle chat state handling out of ui module
Diffstat (limited to 'src/profanity.c')
-rw-r--r--src/profanity.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 19613f7d..06067d93 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -453,7 +453,31 @@ prof_handle_idle(void)
 {
     jabber_conn_status_t status = jabber_get_connection_status();
     if (status == JABBER_CONNECTED) {
-        ui_idle();
+        GSList *recipients = ui_get_recipients();
+        GSList *curr = recipients;
+
+        while (curr != NULL) {
+            char *recipient = curr->data;
+            chat_session_no_activity(recipient);
+
+            if (chat_session_is_gone(recipient) &&
+                    !chat_session_get_sent(recipient)) {
+                message_send_gone(recipient);
+            } else if (chat_session_is_inactive(recipient) &&
+                    !chat_session_get_sent(recipient)) {
+                message_send_inactive(recipient);
+            } else if (prefs_get_boolean(PREF_OUTTYPE) &&
+                    chat_session_is_paused(recipient) &&
+                    !chat_session_get_sent(recipient)) {
+                message_send_paused(recipient);
+            }
+
+            curr = g_slist_next(curr);
+        }
+
+        if (recipients != NULL) {
+            g_slist_free(recipients);
+        }
     }
 }