From 287fb2d9fabd2703c17020c4fd9493e8531c0a03 Mon Sep 17 00:00:00 2001
From: Marcus Lundblad <ml@update.uu.se>
Date: Fri, 18 May 2012 11:29:12 +0000
Subject: Fix for initiating a video call from an Android tablet.

Reviewed-by: Sjoerd Simons <sjoerd@greynoise.nl>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36998
---
Index: telepathy-gabble-0.16.0/gabble/capabilities.h
===================================================================
--- telepathy-gabble-0.16.0.orig/gabble/capabilities.h	2011-12-15 11:44:36.000000000 +0100
+++ telepathy-gabble-0.16.0/gabble/capabilities.h	2012-07-09 17:23:30.076393715 +0200
@@ -33,6 +33,8 @@
 #define QUIRK_OMITS_CONTENT_CREATORS "\x07omits-content-creators"
 /* The Google Webmail client doesn't support some features */
 #define QUIRK_GOOGLE_WEBMAIL_CLIENT "\x07google-webmail-client"
+/* The Android GTalk client needs a quirk for component names */
+#define QUIRK_ANDROID_GTALK_CLIENT "\x07android-gtalk-client"
 
 /* Some useful capability sets for Jingle etc. */
 const GabbleCapabilitySet *gabble_capabilities_get_legacy (void);
Index: telepathy-gabble-0.16.0/src/jingle-media-rtp.c
===================================================================
--- telepathy-gabble-0.16.0.orig/src/jingle-media-rtp.c	2012-03-07 21:26:07.000000000 +0100
+++ telepathy-gabble-0.16.0/src/jingle-media-rtp.c	2012-07-09 17:23:30.080393715 +0200
@@ -336,7 +336,9 @@
       if (priv->media_type == JINGLE_MEDIA_TYPE_VIDEO &&
           (JINGLE_IS_GOOGLE_DIALECT (dialect) ||
            gabble_jingle_session_peer_has_cap (content->session,
-               QUIRK_GOOGLE_WEBMAIL_CLIENT)))
+               QUIRK_GOOGLE_WEBMAIL_CLIENT) ||
+           gabble_jingle_session_peer_has_cap (content->session,
+               QUIRK_ANDROID_GTALK_CLIENT)))
         {
           jingle_transport_google_set_component_name (gtrans, "video_rtp", 1);
           jingle_transport_google_set_component_name (gtrans, "video_rtcp", 2);
Index: telepathy-gabble-0.16.0/src/presence-cache.c
===================================================================
--- telepathy-gabble-0.16.0.orig/src/presence-cache.c	2012-03-07 21:26:07.000000000 +0100
+++ telepathy-gabble-0.16.0/src/presence-cache.c	2012-07-09 17:23:30.088393716 +0200
@@ -1040,6 +1040,18 @@
       gabble_presence_set_capabilities (presence, resource, cap_set, NULL, serial);
       gabble_capability_set_free (cap_set);
     }
+
+  if (!tp_strdiff (node, "http://www.android.com/gtalk/client/caps") ||
+      !tp_strdiff (node, "http://www.android.com/gtalk/client/caps2"))
+    {
+      GabbleCapabilitySet *cap_set = gabble_capability_set_new ();
+
+      DEBUG ("Client is Android GTalk Client");
+
+      gabble_capability_set_add (cap_set, QUIRK_ANDROID_GTALK_CLIENT);
+      gabble_presence_set_capabilities (presence, resource, cap_set, NULL, serial);
+      gabble_capability_set_free (cap_set);
+    }
 }
 
 
