summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2012-05-01 13:45:05 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2012-05-02 11:37:16 +0100
commit1fafed8d0efac5075e7d681a9f80962ae0a8b3a3 (patch)
tree8b761dc8d508f1ebe459e3f715bfd59d3eded1d0
parent59922b9aedd0fc0e24d73a563a3806291672d213 (diff)
capabilities: emit ContactCapabilityChanged where appropriate
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--src/connection-capabilities.c30
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,