about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-08-01 20:48:23 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-08-01 20:48:23 +0200
commit53c31159769296a9797da6653bc070b9467f3c08 (patch)
tree67087393bbd4264da3ecd01db3c52247555fb51b
parentd4150eb7d15c3a8674eaf78a212209381ed95ee9 (diff)
downloadprofani-tty-53c31159769296a9797da6653bc070b9467f3c08.tar.gz
Don't print subscribed message if contact is already in roster
This occured with a user running Cisco Jabber. It seems this server
sends repeated presence subscribed stanzas. And although I find this
strange according to RFC this seems to be ok.

So let's filter them and only display in the console output and to the
log. But don't open seperate windows.

Fix https://github.com/profanity-im/profanity/issues/1165
-rw-r--r--src/event/server_events.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 86a9ae8d..14c0a11a 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -863,9 +863,13 @@ sv_ev_subscription(const char *barejid, jabber_subscr_t type)
         }
         break;
     case PRESENCE_SUBSCRIBED:
-        cons_show("Subscription received from %s", barejid);
         log_info("Subscription received from %s", barejid);
-        ui_print_system_msg_from_recipient(barejid, "Subscribed");
+        cons_show("Subscription received from %s", barejid);
+
+        PContact contact = roster_get_contact(barejid);
+        if (contact == NULL) {
+            ui_print_system_msg_from_recipient(barejid, "Subscribed");
+        }
         break;
     case PRESENCE_UNSUBSCRIBED:
         cons_show("%s deleted subscription", barejid);