diff options
Diffstat (limited to 'libempathy/empathy-individual-manager.c')
-rw-r--r-- | libempathy/empathy-individual-manager.c | 48 |
1 files changed, 11 insertions, 37 deletions
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index fd74e4bbe..71d15bb34 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -37,6 +37,7 @@ #include "empathy-individual-manager.h" #include "empathy-marshal.h" #include "empathy-utils.h" +#include "empathy-contact-manager.h" #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT #include "empathy-debug.h" @@ -510,15 +511,19 @@ empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self, { TpfPersona *persona = l->data; TpConnection *conn; + EmpathyContactManager *manager; if (!TPF_IS_PERSONA (persona)) continue; conn = tp_contact_get_connection (tpf_persona_get_contact (persona)); + manager = empathy_contact_manager_dup_singleton (); - if (empathy_individual_manager_get_flags_for_connection (self, conn) & - EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK) + if (empathy_contact_manager_get_flags_for_connection (manager, conn) & + EMPATHY_CONTACT_LIST_CAN_BLOCK) return TRUE; + + g_object_unref (manager); } return FALSE; @@ -542,6 +547,7 @@ empathy_individual_manager_set_blocked (EmpathyIndividualManager *self, { TpfPersona *persona = l->data; EmpathyContact *contact; + EmpathyContactManager *manager; if (!TPF_IS_PERSONA (persona)) continue; @@ -549,10 +555,12 @@ empathy_individual_manager_set_blocked (EmpathyIndividualManager *self, contact = empathy_contact_dup_from_tp_contact ( tpf_persona_get_contact (persona)); empathy_contact_set_persona (contact, FOLKS_PERSONA (persona)); + manager = empathy_contact_manager_dup_singleton (); empathy_contact_list_set_blocked ( - EMPATHY_CONTACT_LIST (priv->contact_manager), + EMPATHY_CONTACT_LIST (manager), contact, blocked); + g_object_unref (manager); g_object_unref (contact); } } @@ -600,40 +608,6 @@ empathy_individual_manager_remove_group (EmpathyIndividualManager *manager, (gpointer) group); } -EmpathyIndividualManagerFlags -empathy_individual_manager_get_flags_for_connection ( - EmpathyIndividualManager *self, - TpConnection *connection) -{ - EmpathyIndividualManagerPriv *priv; - EmpathyContactListFlags list_flags; - EmpathyIndividualManagerFlags flags; - - g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self), - EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS); - - priv = GET_PRIV (self); - - list_flags = empathy_contact_manager_get_flags_for_connection ( - priv->contact_manager, connection); - - flags = EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS; - if (list_flags & EMPATHY_CONTACT_LIST_CAN_ADD) - flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_ADD; - if (list_flags & EMPATHY_CONTACT_LIST_CAN_REMOVE) - flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_REMOVE; - if (list_flags & EMPATHY_CONTACT_LIST_CAN_ALIAS) - flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_ALIAS; - if (list_flags & EMPATHY_CONTACT_LIST_CAN_GROUP) - flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_GROUP; - if (list_flags & EMPATHY_CONTACT_LIST_CAN_BLOCK) - flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK; - if (list_flags & EMPATHY_CONTACT_LIST_CAN_REPORT_ABUSIVE) - flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_REPORT_ABUSIVE; - - return flags; -} - static void link_personas_cb (FolksIndividualAggregator *aggregator, GAsyncResult *async_result, |