summaryrefslogtreecommitdiff
path: root/plugin-base
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-09-06 13:58:22 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-09-07 14:56:56 +0100
commitb9fe0a468c50cda114222ea55de5b5e7dbd7f4b8 (patch)
tree16512bad8a74960eefd20217ce822afb6592d299 /plugin-base
parent42069fb5754f1ed1d146a660d9528e92bfc52200 (diff)
caps-manager: set caps when a service appears
This is so we know which service is running on which resource. Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'plugin-base')
-rw-r--r--plugin-base/caps-manager.c31
-rw-r--r--plugin-base/utils.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/plugin-base/caps-manager.c b/plugin-base/caps-manager.c
index 73d34fc..2f90850 100644
--- a/plugin-base/caps-manager.c
+++ b/plugin-base/caps-manager.c
@@ -26,6 +26,10 @@
#include <telepathy-glib/channel-manager.h>
#include <telepathy-glib/util.h>
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/interfaces.h>
+
+#include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h>
#include <wocky/wocky-data-form.h>
#include <wocky/wocky-namespaces.h>
@@ -189,6 +193,33 @@ ytst_caps_manager_represent_client (GabbleCapsChannelManager *manager,
GPtrArray *names = g_ptr_array_new ();
GPtrArray *caps = g_ptr_array_new ();
+#ifdef GABBLE
+ guint i;
+
+ for (i = 0; i < filters->len; i++)
+ {
+ GHashTable *channel_class = g_ptr_array_index (filters, i);
+ const gchar *service_name;
+ gchar *cap;
+
+ if (tp_strdiff (tp_asv_get_string (channel_class,
+ TP_IFACE_CHANNEL ".ChannelType"),
+ TP_YTS_IFACE_CHANNEL))
+ continue;
+
+ service_name = tp_asv_get_string (channel_class,
+ TP_YTS_IFACE_CHANNEL ".TargetService");
+
+ if (service_name == NULL)
+ continue;
+
+ cap = g_strdup_printf ("%s#%s",
+ YTST_SERVICE_NS, service_name);
+ gabble_capability_set_add (cap_set, cap);
+ g_free (cap);
+ }
+#endif
+
for (t = cap_tokens; t != NULL && *t != NULL; t++)
{
const gchar *cap = *t;
diff --git a/plugin-base/utils.h b/plugin-base/utils.h
index e73ca8e..48ae2ac 100644
--- a/plugin-base/utils.h
+++ b/plugin-base/utils.h
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
#define YTST_MESSAGE_NS "urn:ytstenut:message"
#define YTST_STATUS_NS "urn:ytstenut:status"
#define YTST_CAPABILITIES_NS "urn:ytstenut:capabilities"
+#define YTST_SERVICE_NS "urn:ytstenut:service"
GQuark ytst_message_error_quark (void);
#define YTST_MESSAGE_ERROR (ytst_message_error_quark ())