diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-05-08 18:04:04 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-05-09 14:59:35 +0200 |
commit | e60b0466429cb381d0cd3e52921c4d0956d36a97 (patch) | |
tree | a87d330dd88a5d3e0523840b1839d2b8f7d7d0a9 /telepathy-glib/connection-contact-list.c | |
parent | ac3538ae8029988458947efda467bc035cf3d3c8 (diff) | |
download | telepathy-glib-e60b0466429cb381d0cd3e52921c4d0956d36a97.tar.gz |
TpConnection: use tp_connection_upgrade_contacts_async()
ContactList API was already depending on newer spec, so it's fine.
Diffstat (limited to 'telepathy-glib/connection-contact-list.c')
-rw-r--r-- | telepathy-glib/connection-contact-list.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/telepathy-glib/connection-contact-list.c b/telepathy-glib/connection-contact-list.c index 28486072f..9b0678418 100644 --- a/telepathy-glib/connection-contact-list.c +++ b/telepathy-glib/connection-contact-list.c @@ -134,16 +134,17 @@ contacts_changed_head_ready (TpConnection *self) } static void -new_contacts_upgraded_cb (TpConnection *self, - guint n_contacts, - TpContact * const *contacts, - const GError *error, - gpointer user_data, - GObject *weak_object) +new_contacts_upgraded_cb (GObject *object, + GAsyncResult *result, + gpointer user_data) { - if (error != NULL) + TpConnection *self = (TpConnection *) object; + GError *error = NULL; + + if (!tp_connection_upgrade_contacts_finish (self, result, NULL, &error)) { DEBUG ("Error upgrading new roster contacts: %s", error->message); + g_clear_error (&error); } contacts_changed_head_ready (self); @@ -189,10 +190,10 @@ process_queued_contacts_changed (TpConnection *self) features = tp_simple_client_factory_dup_contact_features ( tp_proxy_get_factory (self), self); - tp_connection_upgrade_contacts (self, + tp_connection_upgrade_contacts_async (self, item->new_contacts->len, (TpContact **) item->new_contacts->pdata, features->len, (TpContactFeature *) features->data, - new_contacts_upgraded_cb, NULL, NULL, NULL); + new_contacts_upgraded_cb, NULL); g_array_unref (features); } @@ -1655,31 +1656,32 @@ blocked_changed_head_ready (TpConnection *self) } static void -blocked_contacts_upgraded_cb (TpConnection *self, - guint n_contacts, - TpContact * const *contacts, - const GError *error, - gpointer user_data, - GObject *weak_object) +blocked_contacts_upgraded_cb (GObject *object, + GAsyncResult *result, + gpointer user_data) { + TpConnection *self = (TpConnection *) object; BlockedChangedItem *item; guint i; GPtrArray *added, *removed; + GPtrArray *contacts; + GError *error = NULL; item = g_queue_peek_head (self->priv->blocked_changed_queue); - if (error != NULL) + if (!tp_connection_upgrade_contacts_finish (self, result, &contacts, &error)) { DEBUG ("Error upgrading blocked contacts: %s", error->message); + g_clear_error (&error); goto out; } added = g_ptr_array_new (); removed = g_ptr_array_new_with_free_func (g_object_unref); - for (i = 0; i < n_contacts; i++) + for (i = 0; i < contacts->len; i++) { - TpContact *contact = contacts[i]; + TpContact *contact = g_ptr_array_index (contacts, i); TpHandle handle; handle = tp_contact_get_handle (contact); @@ -1718,6 +1720,7 @@ blocked_contacts_upgraded_cb (TpConnection *self, g_ptr_array_unref (added); g_ptr_array_unref (removed); + g_ptr_array_unref (contacts); out: blocked_changed_head_ready (self); @@ -1782,10 +1785,10 @@ process_queued_blocked_changed (TpConnection *self) features = tp_simple_client_factory_dup_contact_features ( tp_proxy_get_factory (self), self); - tp_connection_upgrade_contacts (self, + tp_connection_upgrade_contacts_async (self, contacts->len, (TpContact **) contacts->pdata, features->len, (TpContactFeature *) features->data, - blocked_contacts_upgraded_cb, NULL, NULL, NULL); + blocked_contacts_upgraded_cb, NULL); g_array_unref (features); g_ptr_array_unref (contacts); |