diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2008-03-10 16:23:17 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2008-03-10 16:23:17 +0000 |
commit | 72a9f657aa89f78c10dbd35f502c3231042fa723 (patch) | |
tree | 3cb040c9d17f1652f79eea8a5b4954a763a0702a | |
parent | 69cfda60fca3972979446c462a244d0e8ad6dd8a (diff) | |
download | telepathy-haze-72a9f657aa89f78c10dbd35f502c3231042fa723.tar.gz |
Implement AccountUiOps::close_account_request.
20080310162317-9f02e-50ea351c23246389c531305e7e0dd9df3971cef9.gz
-rw-r--r-- | src/connection.c | 2 | ||||
-rw-r--r-- | src/contact-list-channel.c | 33 | ||||
-rw-r--r-- | src/contact-list-channel.h | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/src/connection.c b/src/connection.c index f92efe7..14a1051 100644 --- a/src/connection.c +++ b/src/connection.c @@ -560,7 +560,7 @@ account_ui_ops = haze_connection_presence_account_status_changed, /* status_changed */ NULL, /* request_add */ haze_request_authorize, /* request_authorize */ - NULL, /* close_account_request */ + haze_close_account_request, /* close_account_request */ NULL, /* purple_reserved1 */ NULL, /* purple_reserved2 */ diff --git a/src/contact-list-channel.c b/src/contact-list-channel.c index ac38d7c..1728128 100644 --- a/src/contact-list-channel.c +++ b/src/contact-list-channel.c @@ -413,6 +413,39 @@ haze_request_authorize (PurpleAccount *account, } +void +haze_close_account_request (gpointer request_data_) +{ + PublishRequestData *request_data = request_data_; + HazeContactListChannel *publish = request_data->publish; + HazeContactListChannelPrivate *priv = + HAZE_CONTACT_LIST_CHANNEL_GET_PRIVATE (publish); + + TpBaseConnection *base_conn = TP_BASE_CONNECTION (priv->conn); + TpHandleRepoIface *handle_repo = + tp_base_connection_get_handles (base_conn, TP_HANDLE_TYPE_CONTACT); + + TpIntSet *remove = tp_intset_new (); + + gpointer key = GUINT_TO_POINTER (request_data->handle); + gboolean removed; + + DEBUG ("cancelling publish request for handle %u", request_data->handle); + + tp_intset_add (remove, request_data->handle); + tp_group_mixin_change_members (G_OBJECT (publish), NULL, NULL, remove, NULL, + NULL, base_conn->self_handle, TP_CHANNEL_GROUP_CHANGE_REASON_NONE); + tp_intset_destroy (remove); + + removed = g_hash_table_remove (priv->pending_publish_requests, key); + g_assert (removed); + /* Get rid of the hash table's ref of the handle. */ + tp_handle_unref (handle_repo, request_data->handle); + publish_request_data_free (request_data); +} + + + static void haze_contact_list_channel_init (HazeContactListChannel *self) { diff --git a/src/contact-list-channel.h b/src/contact-list-channel.h index 106cd9c..86eed38 100644 --- a/src/contact-list-channel.h +++ b/src/contact-list-channel.h @@ -52,6 +52,8 @@ gpointer haze_request_authorize (PurpleAccount *account, PurpleAccountRequestAuthorizationCb authorize_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data); +void haze_close_account_request (gpointer request_data_); + /* TYPE MACROS */ #define HAZE_TYPE_CONTACT_LIST_CHANNEL \ (haze_contact_list_channel_get_type ()) |