diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-05-13 11:45:19 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-05-13 14:16:59 +0200 |
commit | 3cb2d943e85b59ae2ef3872b9c745cb70384158a (patch) | |
tree | 48ee707bc4768e3641be94008cdd8da5b5c5f3ae | |
parent | c426d3352fcae3cc37c6abc0e88d8cdc49043289 (diff) | |
download | telepathy-glib-3cb2d943e85b59ae2ef3872b9c745cb70384158a.tar.gz |
allow CMs to put 'TargetEntityType=None' in contact search requests
Fix https://bugs.freedesktop.org/show_bug.cgi?id=77030
-rw-r--r-- | telepathy-glib/capabilities.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/telepathy-glib/capabilities.c b/telepathy-glib/capabilities.c index 1181b473f..cc5dc9fa3 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++) |