[Pkg-telepathy-commits] [telepathy-glib-1] 205/212: allow CMs to put 'TargetEntityType=None' in contact search requests

Simon McVittie smcv at debian.org
Wed May 14 12:09:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-glib-1.

commit 3cb2d943e85b59ae2ef3872b9c745cb70384158a
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Tue May 13 11:45:19 2014 +0200

    allow CMs to put 'TargetEntityType=None' in contact search requests
    
    Fix https://bugs.freedesktop.org/show_bug.cgi?id=77030
---
 telepathy-glib/capabilities.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/telepathy-glib/capabilities.c b/telepathy-glib/capabilities.c
index 1181b47..cc5dc9f 100644
--- a/telepathy-glib/capabilities.c
+++ b/telepathy-glib/capabilities.c
@@ -910,17 +910,27 @@ tp_capabilities_supports_contact_search (TpCapabilities *self,
         &allowed_properties))
     {
       const gchar *chan_type;
-
-      /* ContactSearch channel should have ChannelType and TargetEntityType=NONE
-       * but CM implementations are wrong and omitted TargetEntityType,
-       * so it's set in stone now.  */
-      if (g_variant_n_children (fixed) != 1)
-        continue;
+      TpEntityType entity_type;
+      gboolean valid;
+      /* ChannelType is mandatory, TargetEntityType is optionnal */
+      guint nb_fixed_props = 1;
 
       chan_type = tp_vardict_get_string (fixed, TP_PROP_CHANNEL_CHANNEL_TYPE);
       if (tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1))
         continue;
 
+      entity_type = tp_vardict_get_uint32 (fixed,
+          TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, &valid);
+      /* If TargetEntityType is missing we treat it as NONE */
+      if (valid && entity_type != TP_ENTITY_TYPE_NONE)
+        continue;
+
+      if (valid)
+        nb_fixed_props++;
+
+      if (g_variant_n_children (fixed) != nb_fixed_props)
+        continue;
+
       ret = TRUE;
 
       for (j = 0; allowed_properties[j] != NULL; j++)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib-1.git



More information about the Pkg-telepathy-commits mailing list