diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-02-07 10:41:40 +0800 |
---|---|---|
committer | Chandni Verma <chandniverma2112@gmail.com> | 2011-03-08 08:56:51 +0800 |
commit | 35500a8b9e672f703059707039a1ccee23dd3597 (patch) | |
tree | 0fe16c345ecf16219cfe8b1cc4d38ebe174f280d /libempathy/empathy-contact-manager.c | |
parent | 67d602af3ed86c8df908dd8ad429bdb3f8ff5d5b (diff) | |
download | gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.tar gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.tar.gz gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.tar.bz2 gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.tar.lz gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.tar.xz gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.tar.zst gsoc2013-empathy-35500a8b9e672f703059707039a1ccee23dd3597.zip |
Add contact blocking to EmpathyContactList and friends
Diffstat (limited to 'libempathy/empathy-contact-manager.c')
-rw-r--r-- | libempathy/empathy-contact-manager.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index a900fa610..2242159b5 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -865,6 +865,45 @@ contact_manager_remove_group (EmpathyContactList *manager, } static void +contact_manager_set_blocked (EmpathyContactList *manager, + EmpathyContact *contact, + gboolean blocked) +{ + EmpathyContactManagerPriv *priv = GET_PRIV (manager); + EmpathyContactList *list; + TpConnection *connection; + + g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager)); + + connection = empathy_contact_get_connection (contact); + list = g_hash_table_lookup (priv->lists, connection); + + if (list != NULL) { + empathy_contact_list_set_blocked (list, contact, blocked); + } +} + +static gboolean +contact_manager_get_blocked (EmpathyContactList *manager, + EmpathyContact *contact) +{ + EmpathyContactManagerPriv *priv = GET_PRIV (manager); + EmpathyContactList *list; + TpConnection *connection; + + g_return_val_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager), FALSE); + + connection = empathy_contact_get_connection (contact); + list = g_hash_table_lookup (priv->lists, connection); + + if (list != NULL) { + return empathy_contact_list_get_blocked (list, contact); + } else { + return FALSE; + } +} + +static void contact_manager_iface_init (EmpathyContactListIface *iface) { iface->add = contact_manager_add; @@ -880,6 +919,8 @@ contact_manager_iface_init (EmpathyContactListIface *iface) iface->is_favourite = contact_manager_is_favourite; iface->remove_favourite = contact_manager_remove_favourite; iface->add_favourite = contact_manager_add_favourite; + iface->set_blocked = contact_manager_set_blocked; + iface->get_blocked = contact_manager_get_blocked; } EmpathyContactListFlags |