]> git.0d.be Git - empathy.git/blob - libempathy/empathy-individual-manager.c
Merge branch '657335-Preferences-Calls-Tab'
[empathy.git] / libempathy / empathy-individual-manager.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2007-2010 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * Authors: Xavier Claessens <xclaesse@gmail.com>
20  *          Travis Reitter <travis.reitter@collabora.co.uk>
21  */
22
23 #include <config.h>
24
25 #include <string.h>
26
27 #include <telepathy-glib/account-manager.h>
28 #include <telepathy-glib/enums.h>
29 #include <telepathy-glib/proxy-subclass.h>
30 #include <telepathy-glib/util.h>
31
32 #include <folks/folks.h>
33 #include <folks/folks-telepathy.h>
34
35 #include <extensions/extensions.h>
36
37 #include "empathy-individual-manager.h"
38 #include "empathy-marshal.h"
39 #include "empathy-utils.h"
40 #include "empathy-contact-manager.h"
41
42 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
43 #include "empathy-debug.h"
44
45 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIndividualManager)
46
47 /* This class only stores and refs Individuals who contain an EmpathyContact.
48  *
49  * This class merely forwards along signals from the aggregator and individuals
50  * and wraps aggregator functions for other client code. */
51 typedef struct
52 {
53   FolksIndividualAggregator *aggregator;
54   GHashTable *individuals; /* Individual.id -> Individual */
55 } EmpathyIndividualManagerPriv;
56
57 enum
58 {
59   FAVOURITES_CHANGED,
60   GROUPS_CHANGED,
61   MEMBERS_CHANGED,
62   LAST_SIGNAL
63 };
64
65 static guint signals[LAST_SIGNAL] = { 0 };
66
67 G_DEFINE_TYPE (EmpathyIndividualManager, empathy_individual_manager,
68     G_TYPE_OBJECT);
69
70 static EmpathyIndividualManager *manager_singleton = NULL;
71
72 static void
73 individual_group_changed_cb (FolksIndividual *individual,
74     gchar *group,
75     gboolean is_member,
76     EmpathyIndividualManager *self)
77 {
78   g_signal_emit (self, signals[GROUPS_CHANGED], 0, individual, group,
79       is_member);
80 }
81
82 static void
83 individual_notify_is_favourite_cb (FolksIndividual *individual,
84     GParamSpec *pspec,
85     EmpathyIndividualManager *self)
86 {
87   gboolean is_favourite = folks_favourite_details_get_is_favourite (
88       FOLKS_FAVOURITE_DETAILS (individual));
89   g_signal_emit (self, signals[FAVOURITES_CHANGED], 0, individual,
90       is_favourite);
91 }
92
93 static void
94 add_individual (EmpathyIndividualManager *self, FolksIndividual *individual)
95 {
96   EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
97
98   g_hash_table_insert (priv->individuals,
99       (gpointer) folks_individual_get_id (individual),
100       g_object_ref (individual));
101
102   g_signal_connect (individual, "group-changed",
103       G_CALLBACK (individual_group_changed_cb), self);
104   g_signal_connect (individual, "notify::is-favourite",
105       G_CALLBACK (individual_notify_is_favourite_cb), self);
106 }
107
108 static void
109 remove_individual (EmpathyIndividualManager *self, FolksIndividual *individual)
110 {
111   EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
112
113   g_signal_handlers_disconnect_by_func (individual,
114       individual_group_changed_cb, self);
115   g_signal_handlers_disconnect_by_func (individual,
116       individual_notify_is_favourite_cb, self);
117
118   g_hash_table_remove (priv->individuals, folks_individual_get_id (individual));
119 }
120
121 /* This is emitted for *all* individuals in the individual aggregator (not
122  * just the ones we keep a reference to), to allow for the case where a new
123  * individual doesn't contain an EmpathyContact, but later has a persona added
124  * which does. */
125 static void
126 individual_notify_personas_cb (FolksIndividual *individual,
127     GParamSpec *pspec,
128     EmpathyIndividualManager *self)
129 {
130   EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
131
132   const gchar *id = folks_individual_get_id (individual);
133   gboolean has_contact = empathy_folks_individual_contains_contact (individual);
134   gboolean had_contact = (g_hash_table_lookup (priv->individuals,
135       id) != NULL) ? TRUE : FALSE;
136
137   if (had_contact == TRUE && has_contact == FALSE)
138     {
139       GList *removed = NULL;
140
141       /* The Individual has lost its EmpathyContact */
142       removed = g_list_prepend (removed, individual);
143       g_signal_emit (self, signals[MEMBERS_CHANGED], 0, NULL, NULL, removed,
144           TP_CHANNEL_GROUP_CHANGE_REASON_NONE /* FIXME */);
145       g_list_free (removed);
146
147       remove_individual (self, individual);
148     }
149   else if (had_contact == FALSE && has_contact == TRUE)
150     {
151       GList *added = NULL;
152
153       /* The Individual has gained its first EmpathyContact */
154       add_individual (self, individual);
155
156       added = g_list_prepend (added, individual);
157       g_signal_emit (self, signals[MEMBERS_CHANGED], 0, NULL, added, NULL,
158           TP_CHANNEL_GROUP_CHANGE_REASON_NONE /* FIXME */);
159       g_list_free (added);
160     }
161 }
162
163 static void
164 aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
165     GeeSet *added,
166     GeeSet *removed,
167     const char *message,
168     FolksPersona *actor,
169     guint reason,
170     EmpathyIndividualManager *self)
171 {
172   EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
173   GeeIterator *iter;
174   GList *added_filtered = NULL, *removed_list = NULL;
175
176   /* Handle the removals first, as one of the added Individuals might have the
177    * same ID as one of the removed Individuals (due to linking). */
178   iter = gee_iterable_iterator (GEE_ITERABLE (removed));
179   while (gee_iterator_next (iter))
180     {
181       FolksIndividual *ind = gee_iterator_get (iter);
182
183       g_signal_handlers_disconnect_by_func (ind,
184           individual_notify_personas_cb, self);
185
186       if (g_hash_table_lookup (priv->individuals,
187           folks_individual_get_id (ind)) != NULL)
188         {
189           remove_individual (self, ind);
190           removed_list = g_list_prepend (removed_list, ind);
191         }
192
193       g_clear_object (&ind);
194     }
195   g_clear_object (&iter);
196
197   /* Filter the individuals for ones which contain EmpathyContacts */
198   iter = gee_iterable_iterator (GEE_ITERABLE (added));
199   while (gee_iterator_next (iter))
200     {
201       FolksIndividual *ind = gee_iterator_get (iter);
202
203       g_signal_connect (ind, "notify::personas",
204           G_CALLBACK (individual_notify_personas_cb), self);
205
206       if (empathy_folks_individual_contains_contact (ind) == TRUE)
207         {
208           add_individual (self, ind);
209           added_filtered = g_list_prepend (added_filtered, ind);
210         }
211
212       g_clear_object (&ind);
213     }
214   g_clear_object (&iter);
215
216   /* Bail if we have no individuals left */
217   if (added_filtered == NULL && removed == NULL)
218     return;
219
220   added_filtered = g_list_reverse (added_filtered);
221
222   g_signal_emit (self, signals[MEMBERS_CHANGED], 0, message,
223       added_filtered, removed_list,
224       tp_channel_group_change_reason_from_folks_groups_change_reason (reason),
225       TRUE);
226
227   g_list_free (added_filtered);
228   g_list_free (removed_list);
229 }
230
231 static void
232 individual_manager_dispose (GObject *object)
233 {
234   EmpathyIndividualManagerPriv *priv = GET_PRIV (object);
235
236   g_hash_table_destroy (priv->individuals);
237
238   g_signal_handlers_disconnect_by_func (priv->aggregator,
239       aggregator_individuals_changed_cb, object);
240   tp_clear_object (&priv->aggregator);
241
242   G_OBJECT_CLASS (empathy_individual_manager_parent_class)->dispose (object);
243 }
244
245 static GObject *
246 individual_manager_constructor (GType type,
247     guint n_props,
248     GObjectConstructParam *props)
249 {
250   GObject *retval;
251
252   if (manager_singleton)
253     {
254       retval = g_object_ref (manager_singleton);
255     }
256   else
257     {
258       retval =
259           G_OBJECT_CLASS (empathy_individual_manager_parent_class)->
260           constructor (type, n_props, props);
261
262       manager_singleton = EMPATHY_INDIVIDUAL_MANAGER (retval);
263       g_object_add_weak_pointer (retval, (gpointer) & manager_singleton);
264     }
265
266   return retval;
267 }
268
269 /**
270  * empathy_individual_manager_initialized:
271  *
272  * Reports whether or not the singleton has already been created.
273  *
274  * There can be instances where you want to access the #EmpathyIndividualManager
275  * only if it has been set up for this process.
276  *
277  * Returns: %TRUE if the #EmpathyIndividualManager singleton has previously
278  * been initialized.
279  */
280 gboolean
281 empathy_individual_manager_initialized (void)
282 {
283   return (manager_singleton != NULL);
284 }
285
286 static void
287 empathy_individual_manager_class_init (EmpathyIndividualManagerClass *klass)
288 {
289   GObjectClass *object_class = G_OBJECT_CLASS (klass);
290
291   object_class->dispose = individual_manager_dispose;
292   object_class->constructor = individual_manager_constructor;
293
294   signals[GROUPS_CHANGED] =
295       g_signal_new ("groups-changed",
296           G_TYPE_FROM_CLASS (klass),
297           G_SIGNAL_RUN_LAST,
298           0,
299           NULL, NULL,
300           _empathy_marshal_VOID__OBJECT_STRING_BOOLEAN,
301           G_TYPE_NONE, 3, FOLKS_TYPE_INDIVIDUAL, G_TYPE_STRING, G_TYPE_BOOLEAN);
302
303   signals[FAVOURITES_CHANGED] =
304       g_signal_new ("favourites-changed",
305           G_TYPE_FROM_CLASS (klass),
306           G_SIGNAL_RUN_LAST,
307           0,
308           NULL, NULL,
309           _empathy_marshal_VOID__OBJECT_BOOLEAN,
310           G_TYPE_NONE, 2, FOLKS_TYPE_INDIVIDUAL, G_TYPE_BOOLEAN);
311
312   signals[MEMBERS_CHANGED] =
313       g_signal_new ("members-changed",
314           G_TYPE_FROM_CLASS (klass),
315           G_SIGNAL_RUN_LAST,
316           0,
317           NULL, NULL,
318           _empathy_marshal_VOID__STRING_OBJECT_OBJECT_UINT,
319           G_TYPE_NONE,
320           4, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_UINT);
321
322   g_type_class_add_private (object_class,
323       sizeof (EmpathyIndividualManagerPriv));
324 }
325
326 static void
327 empathy_individual_manager_init (EmpathyIndividualManager *self)
328 {
329   EmpathyIndividualManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
330       EMPATHY_TYPE_INDIVIDUAL_MANAGER, EmpathyIndividualManagerPriv);
331
332   self->priv = priv;
333   priv->individuals = g_hash_table_new_full (g_str_hash, g_str_equal,
334       NULL, g_object_unref);
335
336   priv->aggregator = folks_individual_aggregator_new ();
337   g_signal_connect (priv->aggregator, "individuals-changed",
338       G_CALLBACK (aggregator_individuals_changed_cb), self);
339   folks_individual_aggregator_prepare (priv->aggregator, NULL, NULL);
340 }
341
342 EmpathyIndividualManager *
343 empathy_individual_manager_dup_singleton (void)
344 {
345   return g_object_new (EMPATHY_TYPE_INDIVIDUAL_MANAGER, NULL);
346 }
347
348 GList *
349 empathy_individual_manager_get_members (EmpathyIndividualManager *self)
350 {
351   EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
352
353   g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self), NULL);
354
355   return g_hash_table_get_values (priv->individuals);
356 }
357
358 FolksIndividual *
359 empathy_individual_manager_lookup_member (EmpathyIndividualManager *self,
360     const gchar *id)
361 {
362   EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
363
364   g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self), NULL);
365
366   return g_hash_table_lookup (priv->individuals, id);
367 }
368
369 static void
370 aggregator_add_persona_from_details_cb (GObject *source,
371     GAsyncResult *result,
372     gpointer user_data)
373 {
374   FolksIndividualAggregator *aggregator = FOLKS_INDIVIDUAL_AGGREGATOR (source);
375   EmpathyContact *contact = EMPATHY_CONTACT (user_data);
376   FolksPersona *persona;
377   GError *error = NULL;
378
379   persona = folks_individual_aggregator_add_persona_from_details_finish (
380       aggregator, result, &error);
381   if (error != NULL)
382     {
383       g_warning ("failed to add individual from contact: %s", error->message);
384       g_clear_error (&error);
385     }
386
387   /* The persona can be NULL even if there wasn't an error, if the persona was
388    * already in the contact list */
389   if (persona != NULL)
390     {
391       /* Set the contact's persona */
392       empathy_contact_set_persona (contact, persona);
393       g_object_unref (persona);
394     }
395
396   g_object_unref (contact);
397 }
398
399 void
400 empathy_individual_manager_add_from_contact (EmpathyIndividualManager *self,
401     EmpathyContact *contact)
402 {
403   EmpathyIndividualManagerPriv *priv;
404   FolksBackendStore *backend_store;
405   FolksBackend *backend;
406   FolksPersonaStore *persona_store;
407   GHashTable* details;
408   GeeMap *persona_stores;
409   TpAccount *account;
410   const gchar *store_id;
411
412   g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self));
413   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
414
415   priv = GET_PRIV (self);
416
417   /* We need to ref the contact since otherwise its linked TpHandle will be
418    * destroyed. */
419   g_object_ref (contact);
420
421   DEBUG ("adding individual from contact %s (%s)",
422       empathy_contact_get_id (contact), empathy_contact_get_alias (contact));
423
424   account = empathy_contact_get_account (contact);
425   store_id = tp_proxy_get_object_path (TP_PROXY (account));
426
427   /* Get the persona store to use */
428   backend_store = folks_backend_store_dup ();
429   backend =
430       folks_backend_store_dup_backend_by_name (backend_store, "telepathy");
431
432   if (backend == NULL)
433     {
434       g_warning ("Failed to add individual from contact: couldn't get "
435           "'telepathy' backend");
436       goto finish;
437     }
438
439   persona_stores = folks_backend_get_persona_stores (backend);
440   persona_store = gee_map_get (persona_stores, store_id);
441
442   if (persona_store == NULL)
443     {
444       g_warning ("Failed to add individual from contact: couldn't get persona "
445           "store '%s'", store_id);
446       goto finish;
447     }
448
449   details = tp_asv_new (
450       "contact", G_TYPE_STRING, empathy_contact_get_id (contact),
451       NULL);
452
453   folks_individual_aggregator_add_persona_from_details (
454       priv->aggregator, NULL, persona_store, details,
455       aggregator_add_persona_from_details_cb, contact);
456
457   g_hash_table_destroy (details);
458   g_object_unref (persona_store);
459
460 finish:
461   tp_clear_object (&backend);
462   tp_clear_object (&backend_store);
463 }
464
465 static void
466 aggregator_remove_individual_cb (GObject *source,
467     GAsyncResult *result,
468     gpointer user_data)
469 {
470   FolksIndividualAggregator *aggregator = FOLKS_INDIVIDUAL_AGGREGATOR (source);
471   GError *error = NULL;
472
473   folks_individual_aggregator_remove_individual_finish (
474       aggregator, result, &error);
475   if (error != NULL)
476     {
477       g_warning ("failed to remove individual: %s", error->message);
478       g_clear_error (&error);
479     }
480 }
481
482 /**
483  * Removes the inner contact from the server (and thus the Individual). Not
484  * meant for de-shelling inner personas from an Individual.
485  */
486 void
487 empathy_individual_manager_remove (EmpathyIndividualManager *self,
488     FolksIndividual *individual,
489     const gchar *message)
490 {
491   EmpathyIndividualManagerPriv *priv;
492
493   g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self));
494   g_return_if_fail (FOLKS_IS_INDIVIDUAL (individual));
495
496   priv = GET_PRIV (self);
497
498   DEBUG ("removing individual %s (%s)",
499       folks_individual_get_id (individual),
500       folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS (individual)));
501
502   folks_individual_aggregator_remove_individual (priv->aggregator, individual,
503       aggregator_remove_individual_cb, self);
504 }
505
506 /* FIXME: The parameter @self is not required and the method can be placed in
507  * utilities. I left it as it is to stay coherent with empathy-2.34 */
508 /**
509  * empathy_individual_manager_supports_blocking
510  * @self: the #EmpathyIndividualManager
511  * @individual: an individual to check
512  *
513  * Indicates whether any personas of an @individual can be blocked.
514  *
515  * Returns: %TRUE if any persona supports contact blocking
516  */
517 gboolean
518 empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self,
519     FolksIndividual *individual)
520 {
521   GeeSet *personas;
522   GeeIterator *iter;
523   gboolean retval = FALSE;
524
525   g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self), FALSE);
526
527   personas = folks_individual_get_personas (individual);
528   iter = gee_iterable_iterator (GEE_ITERABLE (personas));
529   while (!retval && gee_iterator_next (iter))
530     {
531       TpfPersona *persona = gee_iterator_get (iter);
532       TpConnection *conn;
533       EmpathyContactManager *manager;
534
535       if (TPF_IS_PERSONA (persona))
536         {
537           TpContact *tp_contact;
538
539           tp_contact = tpf_persona_get_contact (persona);
540           if (tp_contact != NULL)
541             {
542               conn = tp_contact_get_connection (tp_contact);
543               manager = empathy_contact_manager_dup_singleton ();
544
545               if (empathy_contact_manager_get_flags_for_connection (
546                     manager, conn) &
547                   EMPATHY_CONTACT_LIST_CAN_BLOCK)
548                 retval = TRUE;
549
550               g_object_unref (manager);
551             }
552         }
553       g_clear_object (&persona);
554     }
555   g_clear_object (&iter);
556
557   return retval;
558 }
559
560 void
561 empathy_individual_manager_set_blocked (EmpathyIndividualManager *self,
562     FolksIndividual *individual,
563     gboolean blocked,
564     gboolean abusive)
565 {
566   GeeSet *personas;
567   GeeIterator *iter;
568
569   g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self));
570
571   personas = folks_individual_get_personas (individual);
572   iter = gee_iterable_iterator (GEE_ITERABLE (personas));
573   while (gee_iterator_next (iter))
574     {
575       TpfPersona *persona = gee_iterator_get (iter);
576       EmpathyContact *contact;
577       EmpathyContactManager *manager;
578       EmpathyContactListFlags flags;
579
580       if (TPF_IS_PERSONA (persona))
581         {
582           TpContact *tp_contact;
583
584           tp_contact = tpf_persona_get_contact (persona);
585           if (tp_contact != NULL)
586             {
587               contact = empathy_contact_dup_from_tp_contact (tp_contact);
588               empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
589               manager = empathy_contact_manager_dup_singleton ();
590               flags = empathy_contact_manager_get_flags_for_connection (manager,
591                   empathy_contact_get_connection (contact));
592
593               if (flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
594                 empathy_contact_list_set_blocked (
595                     EMPATHY_CONTACT_LIST (manager),
596                     contact, blocked, abusive);
597
598               g_object_unref (manager);
599               g_object_unref (contact);
600             }
601         }
602       g_clear_object (&persona);
603     }
604   g_clear_object (&iter);
605 }
606
607 static void
608 groups_change_group_cb (GObject *source,
609     GAsyncResult *result,
610     gpointer user_data)
611 {
612   FolksGroupDetails *group_details = FOLKS_GROUP_DETAILS (source);
613   GError *error = NULL;
614
615   folks_group_details_change_group_finish (group_details, result, &error);
616   if (error != NULL)
617     {
618       g_warning ("failed to change group: %s", error->message);
619       g_clear_error (&error);
620     }
621 }
622
623 static void
624 remove_group_cb (const gchar *id,
625     FolksIndividual *individual,
626     const gchar *group)
627 {
628   folks_group_details_change_group (FOLKS_GROUP_DETAILS (individual), group,
629       FALSE, groups_change_group_cb, NULL);
630 }
631
632 void
633 empathy_individual_manager_remove_group (EmpathyIndividualManager *manager,
634     const gchar *group)
635 {
636   EmpathyIndividualManagerPriv *priv;
637
638   g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (manager));
639   g_return_if_fail (group != NULL);
640
641   priv = GET_PRIV (manager);
642
643   DEBUG ("removing group %s", group);
644
645   /* Remove every individual from the group */
646   g_hash_table_foreach (priv->individuals, (GHFunc) remove_group_cb,
647       (gpointer) group);
648 }
649
650 static void
651 link_personas_cb (FolksIndividualAggregator *aggregator,
652     GAsyncResult *async_result,
653     gpointer user_data)
654 {
655   GError *error = NULL;
656
657   folks_individual_aggregator_link_personas_finish (aggregator, async_result,
658       &error);
659
660   if (error != NULL)
661     {
662       g_warning ("Failed to link personas: %s", error->message);
663       g_clear_error (&error);
664     }
665 }
666
667 void
668 empathy_individual_manager_link_personas (EmpathyIndividualManager *self,
669     GeeSet *personas)
670 {
671   EmpathyIndividualManagerPriv *priv;
672
673   g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self));
674   g_return_if_fail (personas != NULL);
675
676   priv = GET_PRIV (self);
677
678   DEBUG ("Linking %u personas",
679       gee_collection_get_size (GEE_COLLECTION (personas)));
680
681   folks_individual_aggregator_link_personas (priv->aggregator, personas,
682       (GAsyncReadyCallback) link_personas_cb, NULL);
683 }
684
685 static void
686 unlink_individual_cb (FolksIndividualAggregator *aggregator,
687     GAsyncResult *async_result,
688     gpointer user_data)
689 {
690   GError *error = NULL;
691
692   folks_individual_aggregator_unlink_individual_finish (aggregator,
693       async_result, &error);
694
695   if (error != NULL)
696     {
697       g_warning ("Failed to unlink individual: %s", error->message);
698       g_clear_error (&error);
699     }
700 }
701
702 void
703 empathy_individual_manager_unlink_individual (EmpathyIndividualManager *self,
704     FolksIndividual *individual)
705 {
706   EmpathyIndividualManagerPriv *priv;
707
708   g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self));
709   g_return_if_fail (FOLKS_IS_INDIVIDUAL (individual));
710
711   priv = GET_PRIV (self);
712
713   DEBUG ("Unlinking individual '%s'", folks_individual_get_id (individual));
714
715   folks_individual_aggregator_unlink_individual (priv->aggregator, individual,
716       (GAsyncReadyCallback) unlink_individual_cb, NULL);
717 }