about summary refs log tree commit diff stats
path: root/src/profanity.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-15 17:19:01 +0000
committerJames Booth <boothj5@gmail.com>2013-12-15 17:19:01 +0000
commit2470f642c73a7b13181bf51a6f3c2ee126e9e733 (patch)
treed578411bda883f02e3c7cc4d256bb5a96c5034bf /src/profanity.c
parent06367723d7b97abe1958944b651cdbbf9b5c856a (diff)
parent2490f5b417a13639771211a7862bab88a6a5195e (diff)
downloadprofani-tty-2470f642c73a7b13181bf51a6f3c2ee126e9e733.tar.gz
Merge branch 'master' into otr
Conflicts:
	src/command/command.c
Diffstat (limited to 'src/profanity.c')
-rw-r--r--src/profanity.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 913f3350..486402e3 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -41,11 +41,11 @@
 #include "command/command.h"
 #include "common.h"
 #include "contact.h"
+#include "roster_list.h"
 #include "log.h"
 #include "muc.h"
 #include "otr.h"
 #include "resource.h"
-#include "ui/notifier.h"
 #include "ui/ui.h"
 #include "xmpp/xmpp.h"
 
@@ -414,7 +414,7 @@ prof_handle_contact_online(char *contact, Resource *resource,
 {
     gboolean updated = roster_update_presence(contact, resource, last_activity);
 
-    if (updated) {
+    if (updated && prefs_get_boolean(PREF_STATUSES)) {
         PContact result = roster_get_contact(contact);
         if (p_contact_subscription(result) != NULL) {
             if (strcmp(p_contact_subscription(result), "none") != 0) {
@@ -431,7 +431,7 @@ prof_handle_contact_offline(char *contact, char *resource, char *status)
 {
     gboolean updated = roster_contact_offline(contact, resource, status);
 
-    if (resource != NULL && updated) {
+    if (resource != NULL && updated && prefs_get_boolean(PREF_STATUSES)) {
         Jid *jid = jid_create_from_bare_and_resource(contact, resource);
         PContact result = roster_get_contact(contact);
         if (p_contact_subscription(result) != NULL) {
@@ -465,7 +465,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);
+        }
     }
 }
 
@@ -666,7 +690,7 @@ _shutdown(void)
     prefs_close();
     theme_close();
     accounts_close();
-    cmd_close();
+    cmd_uninit();
     log_close();
 }