aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-26 11:01:00 +0800
committerDavyd Madeley <davyd@madeley.id.au>2009-07-15 18:12:15 +0800
commit76af883334b3ae82e718c65d74484cc327501cde (patch)
treef107931c0133b252b6eb586d1690ee60252e8a0f
parent015e7e34ba24114d48352f4f5b0dc1a3073625fe (diff)
downloadgsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.tar
gsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.tar.gz
gsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.tar.bz2
gsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.tar.lz
gsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.tar.xz
gsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.tar.zst
gsoc2013-empathy-76af883334b3ae82e718c65d74484cc327501cde.zip
Implement CAN_GROUP by looking at RequestableChannelClasses
-rw-r--r--libempathy/empathy-tp-contact-list.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index e81528c80..5e52fe351 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -530,6 +530,45 @@ tp_contact_list_get_alias_flags_cb (TpConnection *connection,
}
static void
+tp_contact_list_get_requestablechannelclasses_cb (TpProxy *connection,
+ const GValue *value,
+ const GError *error,
+ gpointer user_data,
+ GObject *list)
+{
+ EmpathyTpContactListPriv *priv = GET_PRIV (list);
+ GPtrArray *classes;
+ int i;
+
+ if (error) {
+ DEBUG ("Error: %s", error->message);
+ return;
+ }
+
+ classes = g_value_get_boxed (value);
+ for (i = 0; i < classes->len; i++) {
+ GValueArray *class = g_ptr_array_index (classes, i);
+ GHashTable *props;
+ const char *channel_type;
+ guint handle_type;
+
+ props = g_value_get_boxed (g_value_array_get_nth (class, 0));
+
+ channel_type = tp_asv_get_string (props,
+ TP_IFACE_CHANNEL ".ChannelType");
+ handle_type = tp_asv_get_uint32 (props,
+ TP_IFACE_CHANNEL ".TargetHandleType", NULL);
+
+ if (!strcmp (channel_type, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST) &&
+ handle_type == TP_HANDLE_TYPE_GROUP) {
+ DEBUG ("Got channel class for a contact group");
+ priv->flags |= EMPATHY_CONTACT_LIST_CAN_GROUP;
+ break;
+ }
+ }
+}
+
+static void
tp_contact_list_publish_request_handle_cb (TpConnection *connection,
const GArray *handles,
const GError *error,
@@ -754,7 +793,20 @@ tp_contact_list_constructed (GObject *list)
G_OBJECT (list));
}
- /* FIXME: lookup RequestableChannelClasses */
+ /* lookup RequestableChannelClasses */
+ if (tp_proxy_has_interface_by_id (priv->connection,
+ TP_IFACE_QUARK_CONNECTION_INTERFACE_REQUESTS)) {
+ tp_cli_dbus_properties_call_get (priv->connection,
+ -1,
+ TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
+ "RequestableChannelClasses",
+ tp_contact_list_get_requestablechannelclasses_cb,
+ NULL, NULL,
+ G_OBJECT (list));
+ } else {
+ /* we just don't know... better mark the flag just in case */
+ priv->flags |= EMPATHY_CONTACT_LIST_CAN_GROUP;
+ }
names[0] = "publish";
tp_cli_connection_call_request_handles (priv->connection,