[telepathy-gabble/telepathy-gabble-0.8] connection: always set pmuc-v1 capability when sending presence

Jonny Lamb jonny.lamb at collabora.co.uk
Mon Dec 7 04:12:59 PST 2009


If you are invited to a Google private MUC, then google's server
(talk.google.com) will get your caps and if you have the "pmuc-v1" cap
set as an entity capability element, it will invite you like any
normal MUC.

Partly ixes fd.o#22768 (as long as discoing chatrooms is
disabled). This commit enables us to be invited to private MUCs by the
Google client, but doesn't currently support creating them without
making the UI terrible.

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
 src/connection.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 46bb4a5..8fe2fc2 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1592,6 +1592,7 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
   LmMessageNode *node = lm_message_get_node (message);
   gboolean ret;
   gchar *caps_hash;
+  GString *ext = g_string_new ("");
 
   if (presence->status == GABBLE_PRESENCE_HIDDEN)
     {
@@ -1617,25 +1618,20 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
   /* XEP-0115 deprecates 'ext' feature bundles. But we still need
    * BUNDLE_VOICE_V1 it for backward-compatibility with Gabble 0.2 */
 
+  g_string_append (ext, BUNDLE_PMUC_V1);
+
   if (presence->caps & (PRESENCE_CAP_GOOGLE_VOICE|PRESENCE_CAP_GOOGLE_VIDEO))
     {
-      GString *ext = g_string_new ("");
-
       if (presence->caps & PRESENCE_CAP_GOOGLE_VOICE)
-        g_string_append (ext, BUNDLE_VOICE_V1);
+        g_string_append (ext, " " BUNDLE_VOICE_V1);
 
       if (presence->caps & PRESENCE_CAP_GOOGLE_VIDEO)
-        {
-          if (ext->len > 0)
-            g_string_append_c (ext, ' ');
-          g_string_append (ext, BUNDLE_VIDEO_V1);
-        }
-
-      lm_message_node_set_attribute (node, "ext", ext->str);
-
-      g_string_free (ext, TRUE);
+        g_string_append (ext, " " BUNDLE_VIDEO_V1);
     }
 
+  lm_message_node_set_attribute (node, "ext", ext->str);
+  g_string_free (ext, TRUE);
+
   ret = _gabble_connection_send (self, message, error);
 
   g_free (caps_hash);
-- 
1.5.6.5




More information about the telepathy-commits mailing list