aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-07-02 18:29:05 +0800
committerTravis Reitter <treitter@gmail.com>2010-07-21 07:12:36 +0800
commit265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179 (patch)
treea223d9aaab0b6eb2ca23068480f3fbc9003f05e8 /libempathy
parent0919a8a5cc60ddda3a6d727533c926fa691617d2 (diff)
downloadgsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.tar
gsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.tar.gz
gsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.tar.bz2
gsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.tar.lz
gsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.tar.xz
gsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.tar.zst
gsoc2013-empathy-265ea7ef4abb3df7cf6d8e1c9f4c5bfe68763179.zip
Re-enable changing individuals' groups
This introduces a hacky function to return the individual for a given EmpathyContact, which should go away once we break the assumption that individuals are 1:1 with contacts.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-utils.c29
-rw-r--r--libempathy/empathy-utils.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index d80aad573..ddf56f708 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -43,6 +43,7 @@
#include "empathy-utils.h"
#include "empathy-contact-manager.h"
+#include "empathy-individual-manager.h"
#include "empathy-dispatcher.h"
#include "empathy-dispatch-operation.h"
#include "empathy-idle.h"
@@ -620,3 +621,31 @@ empathy_contact_from_folks_individual (FolksIndividual *individual)
return contact;
}
+
+/* TODO: This also needs to be eliminated, and is horrifically slow. */
+FolksIndividual *
+folks_individual_from_empathy_contact (EmpathyContact *contact)
+{
+ EmpathyIndividualManager *manager;
+ FolksIndividual *individual = NULL;
+ GList *individuals, *l;
+
+ manager = empathy_individual_manager_dup_singleton ();
+ individuals = empathy_individual_manager_get_members (manager);
+
+ for (l = individuals; (l != NULL) && (individual == NULL); l = l->next)
+ {
+ FolksIndividual *i = FOLKS_INDIVIDUAL (l->data);
+ EmpathyContact *c = empathy_contact_from_folks_individual (i);
+
+ if (c == contact)
+ individual = g_object_ref (i);
+
+ g_object_unref (c);
+ }
+
+ g_list_free (individuals);
+ g_object_unref (manager);
+
+ return individual;
+}
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index c6de97a8f..a07f575d8 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -93,6 +93,7 @@ void empathy_connect_new_account (TpAccount *account,
TpConnectionPresenceType empathy_folks_presence_type_to_tp (FolksPresenceType type);
gboolean empathy_folks_individual_contains_contact (FolksIndividual *individual);
EmpathyContact * empathy_contact_from_folks_individual (FolksIndividual *individual);
+FolksIndividual *folks_individual_from_empathy_contact (EmpathyContact *contact);
G_END_DECLS