xmpp_setstatus: send presence to MUC rooms before the global presence
authorMikael Berthe <mikael@lilotux.net>
Mon, 30 Jul 2012 22:39:17 +0200
changeset 2023 26edaf6ea10b
parent 2022 d58fb8d7a09a
child 2024 789779fd728d
xmpp_setstatus: send presence to MUC rooms before the global presence It only matters (AFAICS) when going offline. We want the presence to be sent by mcabber and not by the server, especially if we're using PGP.
mcabber/mcabber/xmpp.c
--- a/mcabber/mcabber/xmpp.c	Sat Jul 28 22:10:33 2012 +0300
+++ b/mcabber/mcabber/xmpp.c	Mon Jul 30 22:39:17 2012 +0200
@@ -2029,6 +2029,20 @@
     // completely.
     const char *s_msg = msg;
 #endif
+
+    if (!recipient) {
+      // This is a global status, send presence to chatrooms
+#ifdef WITH_DEPRECATED_STATUS_INVISIBLE
+      if (st != invisible)
+#endif
+      {
+        struct T_presence room_presence;
+        room_presence.st = st;
+        room_presence.msg = msg;
+        foreach_buddy(ROSTER_TYPE_ROOM, &roompresence, &room_presence);
+      }
+    }
+
     m = lm_message_new_presence(st, recipient, s_msg);
     xmpp_insert_entity_capabilities(m->node, st); // Entity Caps (XEP-0115)
 #ifdef HAVE_GPGME
@@ -2050,19 +2064,6 @@
   // If we didn't change our _global_ status, we are done
   if (recipient) return;
 
-  if (isonline) {
-    // Send presence to chatrooms
-#ifdef WITH_DEPRECATED_STATUS_INVISIBLE
-    if (st != invisible)
-#endif
-    {
-      struct T_presence room_presence;
-      room_presence.st = st;
-      room_presence.msg = msg;
-      foreach_buddy(ROSTER_TYPE_ROOM, &roompresence, &room_presence);
-    }
-  }
-
   if (isonline || !st) {
     // We'll have to update the roster if we switch to/from offline because
     // we don't know the presences of buddies when offline...