[next] telepathy-gabble: search-manager: allow user to pass TargetEntityType=NONE when requesting

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Tue May 13 05:50:43 PDT 2014


Module: telepathy-gabble
Branch: next
Commit: d9aaf72fcfb9924722b99e0ffa9ff684835fc6d0
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=d9aaf72fcfb9924722b99e0ffa9ff684835fc6d0

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Tue May 13 12:03:11 2014 +0200

search-manager: allow user to pass TargetEntityType=NONE when requesting

Fix https://bugs.freedesktop.org/show_bug.cgi?id=77030

---

 src/search-manager.c                  |    9 +++++++++
 tests/twisted/search/search_helper.py |    1 +
 2 files changed, 10 insertions(+)

diff --git a/src/search-manager.c b/src/search-manager.c
index 66a25a3..430f3fa 100644
--- a/src/search-manager.c
+++ b/src/search-manager.c
@@ -318,6 +318,7 @@ gabble_search_manager_foreach_channel (TpChannelManager *manager,
 
 static const gchar * const search_channel_fixed_properties[] = {
     TP_PROP_CHANNEL_CHANNEL_TYPE,
+    TP_PROP_CHANNEL_TARGET_ENTITY_TYPE,
     NULL
 };
 
@@ -337,6 +338,7 @@ gabble_search_manager_type_foreach_channel_class (GType type,
   table = tp_asv_new (
       TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
         TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1,
+      TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, G_TYPE_UINT, TP_ENTITY_TYPE_NONE,
       NULL);
 
   func (type, table, search_channel_allowed_properties, user_data);
@@ -468,6 +470,8 @@ gabble_search_manager_create_channel (TpChannelManager *manager,
   GError *error = NULL;
   const gchar *channel_type;
   const gchar *server;
+  TpEntityType entity_type;
+  gboolean valid;
 
   channel_type = tp_asv_get_string (request_properties,
       TP_PROP_CHANNEL_CHANNEL_TYPE);
@@ -475,6 +479,11 @@ gabble_search_manager_create_channel (TpChannelManager *manager,
   if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1))
     return FALSE;
 
+  entity_type = tp_asv_get_uint32 (request_properties,
+      TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, &valid);
+  if (valid && entity_type != TP_ENTITY_TYPE_NONE)
+    return FALSE;
+
   if (tp_channel_manager_asv_has_unknown_properties (request_properties,
           search_channel_fixed_properties, search_channel_allowed_properties,
           &error))
diff --git a/tests/twisted/search/search_helper.py b/tests/twisted/search/search_helper.py
index 3f9b201..ae08a95 100644
--- a/tests/twisted/search/search_helper.py
+++ b/tests/twisted/search/search_helper.py
@@ -10,6 +10,7 @@ def call_create(q, conn, server):
     request = dbus.Dictionary(
         {
             cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_SEARCH,
+            cs.TARGET_ENTITY_TYPE: cs.HT_NONE,
         }, signature='sv')
 
     if server is not None:



More information about the telepathy-commits mailing list