summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-09-07 17:02:18 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-09-07 17:02:18 +0100
commit30a7ac413f66178c3cceae63baab487365ef8845 (patch)
tree5df5ce86127cc5fa4c83d2bbaff12decadadbfc2
parent485c9d8ad1365cbee11b8c7769425d5d5c02fc27 (diff)
connection: add more public helper functions for getting caps
This is useful so in a Gabble plugin you can get the TpBaseContactList and then look at each contact's caps for whatever reason. Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--gabble/connection.h7
-rw-r--r--src/connection.c23
2 files changed, 30 insertions, 0 deletions
diff --git a/gabble/connection.h b/gabble/connection.h
index 2de081b3..0c946cf1 100644
--- a/gabble/connection.h
+++ b/gabble/connection.h
@@ -22,6 +22,7 @@
#define GABBLE_PLUGINS_CONNECTION_H
#include <telepathy-glib/base-connection.h>
+#include <telepathy-glib/base-contact-list.h>
#include <gabble/capabilities-set.h>
#include <gabble/types.h>
@@ -71,6 +72,12 @@ const gchar * gabble_connection_pick_best_resource_for_caps (
GabbleCapabilitySetPredicate predicate,
gconstpointer user_data);
+TpBaseContactList * gabble_connection_get_contact_list (
+ GabbleConnection *connection);
+
+WockyXep0115Capabilities * gabble_connection_get_caps (
+ GabbleConnection *connection, TpHandle handle);
+
G_END_DECLS
#endif
diff --git a/src/connection.c b/src/connection.c
index 6e8a59ea..dd9bf0ad 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -3882,3 +3882,26 @@ gabble_connection_pick_best_resource_for_caps (GabbleConnection *connection,
return gabble_presence_pick_resource_by_caps (presence, 0,
predicate, user_data);
}
+
+TpBaseContactList *
+gabble_connection_get_contact_list (GabbleConnection *connection)
+{
+ g_return_val_if_fail (GABBLE_IS_CONNECTION (connection), NULL);
+
+ return (TpBaseContactList *) connection->roster;
+}
+
+WockyXep0115Capabilities *
+gabble_connection_get_caps (GabbleConnection *connection,
+ TpHandle handle)
+{
+ GabblePresence *presence;
+
+ g_return_val_if_fail (GABBLE_IS_CONNECTION (connection), NULL);
+ g_return_val_if_fail (handle > 0, NULL);
+
+ presence = gabble_presence_cache_get (connection->presence_cache,
+ handle);
+
+ return (WockyXep0115Capabilities *) presence;
+}