diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-06-09 13:26:17 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-06-09 13:26:17 +0100 |
commit | c9de23b8598fb0358b8ca89a37011012e3feff18 (patch) | |
tree | 5147cf494fc9f7d0e35a72f493a9842bbd02917e | |
parent | 5f61ae42d2cfbdc858ab89adfd4d24311467f387 (diff) |
Emit change notifications for blocked contacts
-rw-r--r-- | src/contact-list.c | 41 | ||||
-rw-r--r-- | src/contact-list.h | 2 | ||||
-rw-r--r-- | src/main.c | 1 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/contact-list.c b/src/contact-list.c index fb70081..80f26c6 100644 --- a/src/contact-list.c +++ b/src/contact-list.c @@ -1315,3 +1315,44 @@ haze_contact_list_blockable_init( vtable->can_block = can_block; } + +static void +haze_contact_list_deny_changed ( + PurpleAccount *account, + const char *name) +{ + HazeConnection *conn = ACCOUNT_GET_HAZE_CONNECTION (account); + TpBaseConnection *base_conn = TP_BASE_CONNECTION (conn); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base_conn, + TP_HANDLE_TYPE_CONTACT); + GError *error = NULL; + TpHandle handle = tp_handle_ensure (contact_repo, name, NULL, &error); + TpHandleSet *set; + + if (handle == 0) + { + g_warning ("Couldn't normalize id '%s': '%s'", name, error->message); + g_clear_error (&error); + return; + } + + set = tp_handle_set_new_containing (contact_repo, handle); + tp_base_contact_list_contact_blocking_changed ( + TP_BASE_CONTACT_LIST (conn->contact_list), + set); + g_object_unref (set); +} + +static PurplePrivacyUiOps privacy_ui_ops = +{ + /* .permit_added = */ NULL, + /* .permit_removed = */ NULL, + /* .deny_added = */ haze_contact_list_deny_changed, + /* .deny_removed = */ haze_contact_list_deny_changed +}; + +PurplePrivacyUiOps * +haze_get_privacy_ui_ops (void) +{ + return &privacy_ui_ops; +} diff --git a/src/contact-list.h b/src/contact-list.h index b6fa085..59b75c2 100644 --- a/src/contact-list.h +++ b/src/contact-list.h @@ -82,4 +82,6 @@ void haze_contact_list_add_to_group (HazeContactList *self, gboolean haze_contact_list_remove_from_group (HazeContactList *self, const gchar *group_name, TpHandle handle, GError **error); +PurplePrivacyUiOps *haze_get_privacy_ui_ops (void); + #endif /* #ifndef __HAZE_CONTACT_LIST_H__*/ @@ -145,6 +145,7 @@ haze_ui_init (void) purple_request_set_ui_ops (haze_request_get_ui_ops ()); #endif purple_notify_set_ui_ops (haze_notify_get_ui_ops ()); + purple_privacy_set_ui_ops (haze_get_privacy_ui_ops ()); } static PurpleCoreUiOps haze_core_uiops = |