mcabber/mcabber/xmpp.c
changeset 2023 26edaf6ea10b
parent 2017 87049d55e34f
child 2027 107d39cd968b
--- 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...