about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-10-06 23:46:35 +0100
committerJames Booth <boothj5@gmail.com>2013-10-06 23:46:35 +0100
commit1d3256ffc7af7a575d692b796930868922a72e85 (patch)
tree0254a87604afaaf2173c25df82e73e04885e44d5
parent7eb5bb6c3d340bd15339962a6b646481c046d69a (diff)
downloadprofani-tty-1d3256ffc7af7a575d692b796930868922a72e85.tar.gz
PREF_STATUSES, moved checks to profanity module
Removed checks from muc presence, and when contact is offline on message
-rw-r--r--src/profanity.c4
-rw-r--r--src/ui/core.c38
2 files changed, 16 insertions, 26 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 4c621ffa..19613f7d 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -402,7 +402,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) {
@@ -419,7 +419,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) {
diff --git a/src/ui/core.c b/src/ui/core.c
index af71bb00..682f7a55 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -400,15 +400,13 @@ ui_contact_online(const char * const barejid, const char * const resource,
     }
 
     ProfWin *console = wins_get_console();
-    ProfWin *window = wins_get_by_recipient(barejid);
+    _show_status_string(console, display_str->str, show, status, last_activity,
+        "++", "online");
 
-    if (prefs_get_boolean(PREF_STATUSES)) {
-        _show_status_string(console, display_str->str, show, status, last_activity,
-            "++", "online");
-        if (window != NULL) {
-            _show_status_string(window, display_str->str, show, status,
-                last_activity, "++", "online");
-        }
+    ProfWin *window = wins_get_by_recipient(barejid);
+    if (window != NULL) {
+        _show_status_string(window, display_str->str, show, status,
+            last_activity, "++", "online");
     }
 
     jid_destroy(jid);
@@ -444,15 +442,13 @@ ui_contact_offline(const char * const from, const char * const show,
     }
 
     ProfWin *console = wins_get_console();
-    ProfWin *window = wins_get_by_recipient(jidp->barejid);
+    _show_status_string(console, display_str->str, show, status, NULL, "--",
+        "offline");
 
-    if (prefs_get_boolean(PREF_STATUSES)) {
-        _show_status_string(console, display_str->str, show, status, NULL, "--",
+    ProfWin *window = wins_get_by_recipient(jidp->barejid);
+    if (window != NULL) {
+        _show_status_string(window, display_str->str, show, status, NULL, "--",
             "offline");
-        if (window != NULL) {
-            _show_status_string(window, display_str->str, show, status, NULL, "--",
-                "offline");
-        }
     }
 
     jid_destroy(jidp);
@@ -926,9 +922,7 @@ ui_new_chat_win(const char * const to)
             if (strcmp(p_contact_presence(contact), "offline") == 0) {
                 const char const *show = p_contact_presence(contact);
                 const char const *status = p_contact_status(contact);
-                if (prefs_get_boolean(PREF_STATUSES)) {
-                    _show_status_string(window, to, show, status, NULL, "--", "offline");
-                }
+                _show_status_string(window, to, show, status, NULL, "--", "offline");
             }
         }
     } else {
@@ -1036,9 +1030,7 @@ ui_outgoing_msg(const char * const from, const char * const to,
             if (strcmp(p_contact_presence(contact), "offline") == 0) {
                 const char const *show = p_contact_presence(contact);
                 const char const *status = p_contact_status(contact);
-                if (prefs_get_boolean(PREF_STATUSES)) {
-                    _show_status_string(window, to, show, status, NULL, "--", "offline");
-                }
+                _show_status_string(window, to, show, status, NULL, "--", "offline");
             }
         }
 
@@ -1169,9 +1161,7 @@ ui_room_member_presence(const char * const room, const char * const nick,
     ProfWin *window = wins_get_by_recipient(room);
 
     if (window != NULL) {
-        if (prefs_get_boolean(PREF_STATUSES)) {
-            _show_status_string(window, nick, show, status, NULL, "++", "online");
-        }
+        _show_status_string(window, nick, show, status, NULL, "++", "online");
     }
 
     if (wins_is_current(window)) {