[next] telepathy-glib: Deprecate tp_connection_get_contacts_by_id/handle()

Xavier Claessens xclaesse at kemper.freedesktop.org
Wed May 9 13:10:52 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 76205ffed60d37618e04c479299c09ee497dcd15
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=76205ffed60d37618e04c479299c09ee497dcd15

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Tue May  8 18:07:47 2012 +0200

Deprecate tp_connection_get_contacts_by_id/handle()

They are replaced by proper _async() API

---

 telepathy-glib/channel-contacts.c    |    5 +++++
 telepathy-glib/connection.c          |    2 ++
 telepathy-glib/contact.c             |    3 +++
 telepathy-glib/contact.h             |    5 +++++
 telepathy-glib/stream-tube-channel.c |    5 ++++-
 5 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c
index 05beac3..3e55584 100644
--- a/telepathy-glib/channel-contacts.c
+++ b/telepathy-glib/channel-contacts.c
@@ -382,6 +382,10 @@ process_contacts_queue (TpChannel *self)
   features = tp_simple_client_factory_dup_contact_features (
       tp_proxy_get_factory (self->priv->connection), self->priv->connection);
 
+  /* We can't use upgrade_contacts_async() because we need compat with older
+   * CMs. by_id and by_handle are used only by TpTextChannel and are needed for
+   * older CMs that does not give both message-sender and message-sender-id */
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   if (item->contacts != NULL && item->contacts->len > 0)
     {
       g_assert (item->ids == NULL);
@@ -426,6 +430,7 @@ process_contacts_queue (TpChannel *self)
        * without reentering mainloop first. */
       g_idle_add (contacts_queue_item_idle_cb, self);
     }
+  G_GNUC_END_IGNORE_DEPRECATIONS
 
   g_array_unref (features);
 }
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index e252f0a..7b3f4bc 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -868,10 +868,12 @@ get_self_contact (TpConnection *self)
    * require immortal-handles and spec change to give the self identifier. */
   /* This relies on the special case in tp_connection_get_contacts_by_handle()
    * which makes it start working slightly early. */
+   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
    tp_connection_get_contacts_by_handle (self,
        1, &self->priv->last_known_self_handle,
       features->len, (TpContactFeature *) features->data,
       tp_connection_got_self_contact_cb, NULL, NULL, NULL);
+   G_GNUC_END_IGNORE_DEPRECATIONS
 
   g_array_unref (features);
 }
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index dc7bca0..a4f4231 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -4159,6 +4159,7 @@ contacts_context_remove_common_features (ContactsContext *context)
  * connection managers.
  *
  * Since: 0.7.18
+ * Deprecated: Use tp_simple_client_factory_ensure_contact() instead.
  */
 void
 tp_connection_get_contacts_by_handle (TpConnection *self,
@@ -4280,6 +4281,7 @@ tp_connection_get_contacts_by_handle (TpConnection *self,
  * connection managers.
  *
  * Since: 0.7.18
+ * Deprecated: Use tp_connection_upgrade_contacts_async() instead.
  */
 void
 tp_connection_upgrade_contacts (TpConnection *self,
@@ -4496,6 +4498,7 @@ contacts_requested_handles (TpConnection *connection,
  * connection managers.
  *
  * Since: 0.7.18
+ * Deprecated: Use tp_connection_get_contact_by_id_async() instead.
  */
 void
 tp_connection_get_contacts_by_id (TpConnection *self,
diff --git a/telepathy-glib/contact.h b/telepathy-glib/contact.h
index bce6747..5e4c6a5 100644
--- a/telepathy-glib/contact.h
+++ b/telepathy-glib/contact.h
@@ -134,11 +134,13 @@ void tp_contact_set_contact_groups_async (TpContact *self,
 gboolean tp_contact_set_contact_groups_finish (TpContact *self,
     GAsyncResult *result, GError **error);
 
+#ifndef TP_DISABLE_DEPRECATED
 typedef void (*TpConnectionContactsByHandleCb) (TpConnection *connection,
     guint n_contacts, TpContact * const *contacts,
     guint n_failed, const TpHandle *failed,
     const GError *error, gpointer user_data, GObject *weak_object);
 
+_TP_DEPRECATED_IN_UNRELEASED
 void tp_connection_get_contacts_by_handle (TpConnection *self,
     guint n_handles, const TpHandle *handles,
     guint n_features, const TpContactFeature *features,
@@ -149,6 +151,7 @@ typedef void (*TpConnectionUpgradeContactsCb) (TpConnection *connection,
     guint n_contacts, TpContact * const *contacts,
     const GError *error, gpointer user_data, GObject *weak_object);
 
+_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_connection_upgrade_contacts_async)
 void tp_connection_upgrade_contacts (TpConnection *self,
     guint n_contacts, TpContact * const *contacts,
     guint n_features, const TpContactFeature *features,
@@ -160,11 +163,13 @@ typedef void (*TpConnectionContactsByIdCb) (TpConnection *connection,
     const gchar * const *requested_ids, GHashTable *failed_id_errors,
     const GError *error, gpointer user_data, GObject *weak_object);
 
+_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_connection_get_contact_by_id_async)
 void tp_connection_get_contacts_by_id (TpConnection *self,
     guint n_ids, const gchar * const *ids,
     guint n_features, const TpContactFeature *features,
     TpConnectionContactsByIdCb callback,
     gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
+#endif
 
 TpContact *tp_connection_dup_contact_if_possible (TpConnection *connection,
     TpHandle handle, const gchar *identifier);
diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c
index 5ab000d..d3bf545 100644
--- a/telepathy-glib/stream-tube-channel.c
+++ b/telepathy-glib/stream-tube-channel.c
@@ -601,7 +601,6 @@ new_local_connection_identified (TpStreamTubeChannel *self,
    * initiator of the tube */
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   initiator_handle = tp_channel_get_initiator_handle (TP_CHANNEL (self));
-  G_GNUC_END_IGNORE_DEPRECATIONS
 
   connection = tp_channel_borrow_connection (TP_CHANNEL (self));
   features = tp_simple_client_factory_dup_contact_features (
@@ -613,6 +612,7 @@ new_local_connection_identified (TpStreamTubeChannel *self,
       features->len, (TpContactFeature *) features->data,
       new_local_connection_with_contact,
       tube_conn, g_object_unref, G_OBJECT (self));
+  G_GNUC_END_IGNORE_DEPRECATIONS
 
   g_array_unref (features);
 }
@@ -1078,12 +1078,15 @@ connection_identified (TpStreamTubeChannel *self,
       features = tp_simple_client_factory_dup_contact_features (
           tp_proxy_get_factory (connection), connection);
 
+      /* Spec does not give the id with the handle */
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
       /* Pass the ref on tube_conn to the function */
       tp_connection_get_contacts_by_handle (connection,
           1, &handle,
           features->len, (TpContactFeature *) features->data,
           _new_remote_connection_with_contact,
           tube_conn, g_object_unref, G_OBJECT (self));
+       G_GNUC_END_IGNORE_DEPRECATIONS
 
       g_array_unref (features);
     }



More information about the telepathy-commits mailing list