telepathy-haze: capabilities: emit ContactCapabilityChanged where appropriate
Jonny Lamb
jonny at kemper.freedesktop.org
Wed May 2 06:32:02 PDT 2012
Module: telepathy-haze
Branch: master
Commit: 1fafed8d0efac5075e7d681a9f80962ae0a8b3a3
URL: http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=1fafed8d0efac5075e7d681a9f80962ae0a8b3a3
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Tue May 1 13:45:05 2012 +0100
capabilities: emit ContactCapabilityChanged where appropriate
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
src/connection-capabilities.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/connection-capabilities.c b/src/connection-capabilities.c
index 9b6b0b1..f2a557f 100644
--- a/src/connection-capabilities.c
+++ b/src/connection-capabilities.c
@@ -35,6 +35,12 @@
#include "mediamanager.h"
#endif
+static void
+free_rcc_list (GPtrArray *rccs)
+{
+ g_boxed_free (TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST, rccs);
+}
+
#ifdef ENABLE_MEDIA
static PurpleMediaCaps
tp_flags_to_purple_caps (guint flags)
@@ -58,6 +64,9 @@ purple_caps_to_tp_flags (PurpleMediaCaps caps)
return flags;
}
+static GPtrArray * haze_connection_get_handle_contact_capabilities (
+ HazeConnection *self, TpHandle handle);
+
static void
_emit_capabilities_changed (HazeConnection *conn,
TpHandle handle,
@@ -106,7 +115,20 @@ _emit_capabilities_changed (HazeConnection *conn,
tp_svc_connection_interface_capabilities_emit_capabilities_changed (
conn, caps_arr);
- /* TODO: ContactCaps */
+ if (caps_arr->len > 0)
+ {
+ GHashTable *ret = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+ NULL, (GDestroyNotify) free_rcc_list);
+ GPtrArray *arr;
+
+ arr = haze_connection_get_handle_contact_capabilities (conn, handle);
+ g_hash_table_insert (ret, GUINT_TO_POINTER (handle), arr);
+
+ tp_svc_connection_interface_contact_capabilities_emit_contact_capabilities_changed (
+ conn, ret);
+
+ g_hash_table_unref (ret);
+ }
for (i = 0; i < caps_arr->len; i++)
{
@@ -518,12 +540,6 @@ haze_connection_capabilities_iface_init (gpointer g_iface,
}
static void
-free_rcc_list (GPtrArray *rccs)
-{
- g_boxed_free (TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST, rccs);
-}
-
-static void
haze_connection_get_contact_capabilities (
TpSvcConnectionInterfaceContactCapabilities *svc,
const GArray *handles,
More information about the telepathy-commits
mailing list