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

Jonny Lamb jonny.lamb at collabora.co.uk
Mon Nov 23 10:20:09 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 fixes 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 |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index f4f41a2..fb61b85 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1964,6 +1964,7 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
   gboolean ret;
   gchar *caps_hash;
   gboolean voice_v1, video_v1;
+  GString *ext = g_string_new ("");
 
   if (presence->status == GABBLE_PRESENCE_HIDDEN)
     {
@@ -1989,27 +1990,19 @@ _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);
+
   voice_v1 = gabble_presence_has_cap (presence, NS_GOOGLE_FEAT_VOICE);
   video_v1 = gabble_presence_has_cap (presence, NS_GOOGLE_FEAT_VIDEO);
 
-  if (voice_v1 || video_v1)
-    {
-      GString *ext = g_string_new ("");
+  if (voice_v1)
+    g_string_append (ext, " " BUNDLE_VOICE_V1);
 
-      if (voice_v1)
-        g_string_append (ext, BUNDLE_VOICE_V1);
+  if (video_v1)
+    g_string_append (ext, " " BUNDLE_VIDEO_V1);
 
-      if (video_v1)
-        {
-          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);
-    }
+  lm_message_node_set_attribute (node, "ext", ext->str);
+  g_string_free (ext, TRUE);
 
   ret = _gabble_connection_send (self, message, error);
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list