aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r--libempathy/empathy-utils.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 2f4c9edde..5730ed555 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -1167,10 +1167,28 @@ empathy_sasl_channel_supports_mechanism (TpChannel *channel,
return tp_strv_contains (available_mechanisms, mechanism);
}
+static FolksIndividual *
+create_individual_from_persona (FolksPersona *persona)
+{
+ GeeSet *personas;
+ FolksIndividual *individual;
+
+ personas = GEE_SET (
+ gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
+ g_direct_hash, g_direct_equal));
+
+ gee_collection_add (GEE_COLLECTION (personas), persona);
+
+ individual = folks_individual_new (personas);
+
+ g_clear_object (&personas);
+
+ return individual;
+}
+
FolksIndividual *
empathy_create_individual_from_tp_contact (TpContact *contact)
{
- GeeSet *personas;
TpfPersona *persona;
FolksIndividual *individual;
@@ -1182,17 +1200,9 @@ empathy_create_individual_from_tp_contact (TpContact *contact)
return NULL;
}
- personas = GEE_SET (
- gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
- g_direct_hash, g_direct_equal));
-
- gee_collection_add (GEE_COLLECTION (personas), persona);
-
- individual = folks_individual_new (personas);
-
- g_clear_object (&persona);
- g_clear_object (&personas);
+ individual = create_individual_from_persona (FOLKS_PERSONA (persona));
+ g_object_unref (persona);
return individual;
}