diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-02 17:59:06 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-08 20:23:16 +0800 |
commit | c627b58b275f7b018ddcf4ea59509207a72f3a2e (patch) | |
tree | ec6bc05c0b765120fa77be50e8df87f6157ac877 /libempathy/empathy-individual-manager.c | |
parent | 2c38acc1cf8810730975e61873191223cf840ae4 (diff) | |
download | gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.tar gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.tar.gz gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.tar.bz2 gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.tar.lz gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.tar.xz gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.tar.zst gsoc2013-empathy-c627b58b275f7b018ddcf4ea59509207a72f3a2e.zip |
individual-manager: use tp-glib blocking API
https://bugzilla.gnome.org/show_bug.cgi?id=661805
Diffstat (limited to 'libempathy/empathy-individual-manager.c')
-rw-r--r-- | libempathy/empathy-individual-manager.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index 833a5692d..044610724 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -546,7 +546,6 @@ empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self, { TpfPersona *persona = gee_iterator_get (iter); TpConnection *conn; - EmpathyContactManager *manager; if (TPF_IS_PERSONA (persona)) { @@ -556,14 +555,10 @@ empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self, if (tp_contact != NULL) { conn = tp_contact_get_connection (tp_contact); - manager = empathy_contact_manager_dup_singleton (); - if (empathy_contact_manager_get_flags_for_connection ( - manager, conn) & - EMPATHY_CONTACT_LIST_CAN_BLOCK) + if (tp_proxy_has_interface_by_id (conn, + TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_BLOCKING)) retval = TRUE; - - g_object_unref (manager); } } g_clear_object (&persona); @@ -589,31 +584,26 @@ empathy_individual_manager_set_blocked (EmpathyIndividualManager *self, while (gee_iterator_next (iter)) { TpfPersona *persona = gee_iterator_get (iter); - EmpathyContact *contact; - EmpathyContactManager *manager; - EmpathyContactListFlags flags; if (TPF_IS_PERSONA (persona)) { TpContact *tp_contact; + TpConnection *conn; tp_contact = tpf_persona_get_contact (persona); - if (tp_contact != NULL) - { - contact = empathy_contact_dup_from_tp_contact (tp_contact); - empathy_contact_set_persona (contact, FOLKS_PERSONA (persona)); - manager = empathy_contact_manager_dup_singleton (); - flags = empathy_contact_manager_get_flags_for_connection (manager, - empathy_contact_get_connection (contact)); - - if (flags & EMPATHY_CONTACT_LIST_CAN_BLOCK) - empathy_contact_list_set_blocked ( - EMPATHY_CONTACT_LIST (manager), - contact, blocked, abusive); - - g_object_unref (manager); - g_object_unref (contact); - } + if (tp_contact == NULL) + continue; + + conn = tp_contact_get_connection (tp_contact); + + if (!tp_proxy_has_interface_by_id (conn, + TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_BLOCKING)) + continue; + + if (blocked) + tp_contact_block_async (tp_contact, abusive, NULL, NULL); + else + tp_contact_unblock_async (tp_contact, NULL, NULL); } g_clear_object (&persona); } |