aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-22 20:54:56 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-25 16:48:29 +0800
commitb014019bb9303a17c5ca4d10ef25f3d60f71dab2 (patch)
treedbd6891f2dcaab326096cbc4dba1f17abcbacc57 /libempathy
parent7e5f89c6fb56ee812d4b90f02c0289b9e77bd0ae (diff)
downloadgsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.tar
gsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.tar.gz
gsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.tar.bz2
gsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.tar.lz
gsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.tar.xz
gsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.tar.zst
gsoc2013-empathy-b014019bb9303a17c5ca4d10ef25f3d60f71dab2.zip
factor out empathy_individual_get_client_types()
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-utils.c42
-rw-r--r--libempathy/empathy-utils.h3
2 files changed, 45 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index c73f6514e..30d40e9a5 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -1231,3 +1231,45 @@ empathy_ensure_individual_from_tp_contact (TpContact *contact)
g_object_unref (persona);
return individual;
}
+
+const gchar * const *
+empathy_individual_get_client_types (FolksIndividual *individual)
+{
+ GeeSet *personas;
+ GeeIterator *iter;
+ const gchar * const *types = NULL;
+ FolksPresenceType presence_type = FOLKS_PRESENCE_TYPE_UNSET;
+
+ personas = folks_individual_get_personas (individual);
+ iter = gee_iterable_iterator (GEE_ITERABLE (personas));
+ while (gee_iterator_next (iter))
+ {
+ FolksPresenceDetails *presence;
+ FolksPersona *persona = gee_iterator_get (iter);
+
+ /* We only want personas which have presence and a TpContact */
+ if (!empathy_folks_persona_is_interesting (persona))
+ goto while_finish;
+
+ presence = FOLKS_PRESENCE_DETAILS (persona);
+
+ if (folks_presence_details_typecmp (
+ folks_presence_details_get_presence_type (presence),
+ presence_type) > 0)
+ {
+ TpContact *tp_contact;
+
+ presence_type = folks_presence_details_get_presence_type (presence);
+
+ tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+ if (tp_contact != NULL)
+ types = tp_contact_get_client_types (tp_contact);
+ }
+
+while_finish:
+ g_clear_object (&persona);
+ }
+ g_clear_object (&iter);
+
+ return types;
+}
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 5ce8cc8cb..dae250608 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -127,6 +127,9 @@ FolksIndividual * empathy_create_individual_from_tp_contact (
FolksIndividual * empathy_ensure_individual_from_tp_contact (
TpContact *contact);
+const gchar * const * empathy_individual_get_client_types (
+ FolksIndividual *individual);
+
/* Copied from wocky/wocky-utils.h */
#define empathy_implement_finish_void(source, tag) \