[next] telepathy-glib: Remove deprecated tp_channel_get_initiator_handle/ identifier()
Xavier Claessens
xclaesse at kemper.freedesktop.org
Thu May 3 12:11:34 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 5b9640845f120f30202ee142e3c74fb215f0001c
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=5b9640845f120f30202ee142e3c74fb215f0001c
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Thu May 3 21:00:05 2012 +0200
Remove deprecated tp_channel_get_initiator_handle/identifier()
---
docs/reference/telepathy-glib-sections.txt | 2 -
telepathy-glib/channel.c | 101 ----------------------------
telepathy-glib/channel.h | 7 --
telepathy-glib/stream-tube-channel.c | 58 ++--------------
tests/dbus/channel-introspect.c | 14 +++-
5 files changed, 17 insertions(+), 165 deletions(-)
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index e3de053..bd9a22a 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -3002,8 +3002,6 @@ tp_channel_get_handle
tp_channel_get_identifier
tp_channel_get_target_contact
tp_channel_get_requested
-tp_channel_get_initiator_handle
-tp_channel_get_initiator_identifier
tp_channel_get_initiator_contact
tp_channel_join_async
tp_channel_join_finish
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index b958b84..2a1ad07 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -95,8 +95,6 @@ enum
PROP_GROUP_SELF_HANDLE,
PROP_GROUP_FLAGS,
PROP_REQUESTED,
- PROP_INITIATOR_HANDLE,
- PROP_INITIATOR_IDENTIFIER,
PROP_PASSWORD_NEEDED,
PROP_TARGET_CONTACT,
PROP_INITIATOR_CONTACT,
@@ -461,12 +459,6 @@ tp_channel_get_property (GObject *object,
case PROP_REQUESTED:
g_value_set_boolean (value, tp_channel_get_requested (self));
break;
- case PROP_INITIATOR_HANDLE:
- g_value_set_uint (value, tp_channel_get_initiator_handle (self));
- break;
- case PROP_INITIATOR_IDENTIFIER:
- g_value_set_string (value, tp_channel_get_initiator_identifier (self));
- break;
case PROP_PASSWORD_NEEDED:
g_value_set_boolean (value, tp_channel_password_needed (self));
break;
@@ -1456,59 +1448,6 @@ tp_channel_class_init (TpChannelClass *klass)
param_spec);
/**
- * TpChannel:initiator-handle:
- *
- * The %TP_HANDLE_TYPE_CONTACT #TpHandle of the initiator of this
- * channel, or 0 if there is no particular initiator.
- *
- * If the channel was initiated by a remote contact, this handle represents
- * that contact, and #TpChannel:requested will be %FALSE. For instance,
- * for an incoming call this property indicates the caller, and for a
- * chatroom invitation this property indicates who sent the invitation.
- *
- * If the channel was requested by the local user, #TpChannel:requested
- * will be %TRUE, and this property may be the #TpChannel:group-self-handle
- * or #TpConnection:self-handle.
- *
- * If the channel appeared for some other reason (for instance as a
- * side-effect of connecting to the server), this property may be 0.
- *
- * This is not guaranteed to be set until tp_proxy_prepare_async() has
- * finished preparing %TP_CHANNEL_FEATURE_CORE; until then, it may be 0.
- *
- * Since: 0.11.15
- * Deprecated: Use #TpChannel:initiator-contact instead.
- */
- param_spec = g_param_spec_uint ("initiator-handle", "TpHandle",
- "The handle of the initiator of the channel",
- 0, G_MAXUINT32, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_INITIATOR_HANDLE,
- param_spec);
-
- /**
- * TpChannel:initiator-identifier:
- *
- * If #TpChannel:initiator-handle is 0, this will always be "".
- * Otherwise, this will be the #TpContact:identifier of the contact
- * with that handle.
- *
- * This is not guaranteed to be set until tp_proxy_prepare_async() has
- * finished preparing %TP_CHANNEL_FEATURE_CORE; until then, it may be
- * the empty string.
- *
- * Since: 0.11.15
- * Deprecated: Use #TpChannel:initiator-contact instead.
- */
- param_spec = g_param_spec_string ("initiator-identifier",
- "Initiator identifier",
- "The identifier of the initiator of the channel",
- "",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_INITIATOR_IDENTIFIER,
- param_spec);
-
- /**
* TpChannel:password-needed:
*
* If %TRUE, tp_channel_provide_password_async() has to be called
@@ -1897,46 +1836,6 @@ tp_channel_get_requested (TpChannel *self)
TP_PROP_CHANNEL_REQUESTED, NULL);
}
-/**
- * tp_channel_get_initiator_handle: (skip)
- * @self: a #TpChannel
- *
- * Return the #TpChannel:initiator-handle property
- *
- * Returns: the value of #TpChannel:initiator-handle
- *
- * Since: 0.11.15
- * Deprecated: New code should use tp_channel_get_initiator_contact() instead.
- */
-TpHandle
-tp_channel_get_initiator_handle (TpChannel *self)
-{
- return tp_asv_get_uint32 (self->priv->channel_properties,
- TP_PROP_CHANNEL_INITIATOR_HANDLE, NULL);
-}
-
-/**
- * tp_channel_get_initiator_identifier: (skip)
- * @self: a #TpChannel
- *
- * Return the #TpChannel:initiator-identifier property
- *
- * Returns: the value of #TpChannel:initiator-identifier
- *
- * Since: 0.11.15
- * Deprecated: New code should use tp_channel_get_initiator_contact() instead.
- */
-const gchar *
-tp_channel_get_initiator_identifier (TpChannel *self)
-{
- const gchar *id;
-
- id = tp_asv_get_string (self->priv->channel_properties,
- TP_PROP_CHANNEL_INITIATOR_ID);
-
- return id != NULL ? id : "";
-}
-
/* tp_cli callbacks can potentially be called in a re-entrant way,
* so we can't necessarily complete @result without using an idle. */
static void
diff --git a/telepathy-glib/channel.h b/telepathy-glib/channel.h
index 5bc8768..470c966 100644
--- a/telepathy-glib/channel.h
+++ b/telepathy-glib/channel.h
@@ -127,13 +127,6 @@ GQuark tp_channel_get_channel_type_id (TpChannel *self);
TpHandle tp_channel_get_handle (TpChannel *self, TpHandleType *handle_type);
const gchar *tp_channel_get_identifier (TpChannel *self);
-#ifndef TP_DISABLE_DEPRECATED
-_TP_DEPRECATED_IN_0_20_FOR (tp_channel_get_initiator_contact)
-TpHandle tp_channel_get_initiator_handle (TpChannel *self);
-
-_TP_DEPRECATED_IN_0_20_FOR (tp_channel_get_initiator_contact)
-const gchar * tp_channel_get_initiator_identifier (TpChannel *self);
-#endif
_TP_AVAILABLE_IN_0_16
TpContact *tp_channel_get_target_contact (TpChannel *self);
_TP_AVAILABLE_IN_0_16
diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c
index 5b501aa..c41f380 100644
--- a/telepathy-glib/stream-tube-channel.c
+++ b/telepathy-glib/stream-tube-channel.c
@@ -549,46 +549,12 @@ complete_accept_operation (TpStreamTubeChannel *self,
}
static void
-new_local_connection_with_contact (TpConnection *conn,
- guint n_contacts,
- TpContact * const *contacts,
- guint n_failed,
- const TpHandle *failed,
- const GError *in_error,
- gpointer user_data,
- GObject *obj)
-{
- TpStreamTubeChannel *self = (TpStreamTubeChannel *) obj;
- TpContact *contact;
- TpStreamTubeConnection *tube_conn = user_data;
-
- if (in_error != NULL)
- {
- DEBUG ("Failed to prepare TpContact: %s", in_error->message);
- return;
- }
-
- if (n_failed > 0)
- {
- DEBUG ("Failed to prepare TpContact (InvalidHandle)");
- return;
- }
-
- contact = contacts[0];
- _tp_stream_tube_connection_set_contact (tube_conn, contact);
-
- complete_accept_operation (self, tube_conn);
-}
-
-static void
new_local_connection_identified (TpStreamTubeChannel *self,
GSocketConnection *conn,
guint connection_id)
{
- TpHandle initiator_handle;
TpStreamTubeConnection *tube_conn;
- TpConnection *connection;
- GArray *features;
+ TpContact *initiator;
tube_conn = _tp_stream_tube_connection_new (conn, self);
@@ -600,22 +566,12 @@ new_local_connection_identified (TpStreamTubeChannel *self,
/* We are accepting a tube so the contact of the connection is the
* 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_client_factory_dup_contact_features (
- tp_proxy_get_factory (connection), connection);
-
- /* Pass ownership of tube_conn to the function */
- tp_connection_get_contacts_by_handle (connection,
- 1, &initiator_handle,
- (const GQuark *) features->data,
- new_local_connection_with_contact,
- tube_conn, g_object_unref, G_OBJECT (self));
-
- g_array_unref (features);
+ initiator = tp_channel_get_initiator_contact (TP_CHANNEL (self));
+ _tp_stream_tube_connection_set_contact (tube_conn, initiator);
+
+ complete_accept_operation (self, tube_conn);
+
+ g_object_unref (tube_conn);
}
#ifdef HAVE_GIO_UNIX
diff --git a/tests/dbus/channel-introspect.c b/tests/dbus/channel-introspect.c
index 9fa30ec..71281bb 100644
--- a/tests/dbus/channel-introspect.c
+++ b/tests/dbus/channel-introspect.c
@@ -49,6 +49,7 @@ assert_chan_sane (TpChannel *chan,
{
GHashTable *asv;
TpHandleType type;
+ TpContact *contact;
g_assert_cmpint (tp_proxy_is_prepared (chan, TP_CHANNEL_FEATURE_CORE), ==,
TRUE);
@@ -62,10 +63,15 @@ assert_chan_sane (TpChannel *chan,
g_assert (TP_IS_CONNECTION (tp_channel_borrow_connection (chan)));
g_assert_cmpstr (tp_channel_get_identifier (chan), ==, IDENTIFIER);
g_assert (tp_channel_get_requested (chan) == requested);
- g_assert_cmpuint (tp_channel_get_initiator_handle (chan), ==,
- initiator_handle);
- g_assert_cmpstr (tp_channel_get_initiator_identifier (chan), ==,
- initiator_id);
+
+ contact = tp_channel_get_initiator_contact (chan);
+ g_assert (contact != NULL);
+ g_assert_cmpuint (tp_contact_get_handle (contact), ==, initiator_handle);
+ g_assert_cmpstr (tp_contact_get_identifier (contact), ==, initiator_id);
+
+ contact = tp_channel_get_target_contact (chan);
+ g_assert (contact != NULL);
+ g_assert_cmpuint (tp_contact_get_handle (contact), ==, handle);
asv = tp_channel_borrow_immutable_properties (chan);
g_assert (asv != NULL);
More information about the telepathy-commits
mailing list