summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-05-03 14:12:44 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-05-03 14:12:58 +0100
commit3369e9abad9e743af0464d445eaadd79fec5abcf (patch)
treead05111b0f2d63ae1453c36f702d9fff0beca607
parentbfa20b72df48c903a1c86327d3cf1b9deb5f9e11 (diff)
Remove deprecated TpConnection:self-handle and its getter
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/channel-group.c7
-rw-r--r--telepathy-glib/connection.c59
-rw-r--r--telepathy-glib/connection.h5
-rw-r--r--tests/dbus/call-channel.c3
-rw-r--r--tests/dbus/connection.c4
-rw-r--r--tests/dbus/contacts.c5
-rw-r--r--tests/dbus/message-mixin.c6
-rw-r--r--tests/dbus/self-handle.c36
9 files changed, 21 insertions, 105 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index c4142fc4d..77fa89007 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -3268,7 +3268,6 @@ tp_connection_get_status
tp_connection_get_connection_manager_name
tp_connection_get_protocol_name
tp_connection_get_self_contact
-tp_connection_get_self_handle
TpConnectionRequestHandlesCb
tp_connection_request_handles
tp_connection_init_known_interfaces
diff --git a/telepathy-glib/channel-group.c b/telepathy-glib/channel-group.c
index b9d703727..5264d2ef7 100644
--- a/telepathy-glib/channel-group.c
+++ b/telepathy-glib/channel-group.c
@@ -25,6 +25,7 @@
#include <telepathy-glib/cli-channel.h>
#include <telepathy-glib/cli-misc.h>
+#include <telepathy-glib/contact.h>
#include <telepathy-glib/dbus.h>
#include <telepathy-glib/gtypes.h>
#include <telepathy-glib/interfaces.h>
@@ -635,7 +636,8 @@ _tp_channel_group_improve_remove_error (TpChannel *self,
{
case TP_CHANNEL_GROUP_CHANGE_REASON_NONE:
if (actor == self->priv->group_self_handle ||
- actor == tp_connection_get_self_handle (self->priv->connection))
+ actor == tp_contact_get_handle (
+ tp_connection_get_self_contact (self->priv->connection)))
{
error->code = TP_ERROR_CANCELLED;
}
@@ -825,7 +827,8 @@ handle_members_changed (TpChannel *self,
tp_intset_remove (self->priv->group_remote_pending, handle);
if (handle == self->priv->group_self_handle ||
- handle == tp_connection_get_self_handle (self->priv->connection))
+ handle == tp_contact_get_handle (tp_connection_get_self_contact (
+ self->priv->connection)))
{
const gchar *error_detail = tp_asv_get_string (details, "error");
const gchar *debug_message = tp_asv_get_string (details,
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index a13d9a097..73beab8ab 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -128,7 +128,6 @@ tp_connection_get_feature_quark_core (void)
* <itemizedlist>
* <listitem>#TpConnection:status is
* %TP_CONNECTION_STATUS_CONNECTED</listitem>
- * <listitem>#TpConnection:self-handle is valid and non-zero</listitem>
* <listitem>#TpConnection:self-contact is non-%NULL</listitem>
* <listitem>all interfaces have been added to the set of
* #TpProxy:interfaces, and that set will not change again</listitem>
@@ -268,7 +267,6 @@ enum
PROP_CONNECTION_MANAGER_NAME,
PROP_PROTOCOL_NAME,
PROP_SELF_CONTACT,
- PROP_SELF_HANDLE,
PROP_CAPABILITIES,
PROP_BALANCE,
PROP_BALANCE_SCALE,
@@ -329,9 +327,6 @@ tp_connection_get_property (GObject *object,
case PROP_SELF_CONTACT:
g_value_set_object (value, tp_connection_get_self_contact (self));
break;
- case PROP_SELF_HANDLE:
- g_value_set_uint (value, tp_connection_get_self_handle (self));
- break;
case PROP_CAPABILITIES:
g_value_set_object (value, self->priv->capabilities);
break;
@@ -788,7 +783,6 @@ tp_connection_set_self_contact (TpConnection *self,
self->priv->self_contact = g_object_ref (contact);
tp_clear_object (&tmp);
g_object_notify ((GObject *) self, "self-contact");
- g_object_notify ((GObject *) self, "self-handle");
}
if (self->priv->introspecting_self_contact)
@@ -1635,29 +1629,6 @@ tp_connection_class_init (TpConnectionClass *klass)
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
/**
- * TpConnection:self-handle:
- *
- * The %TP_HANDLE_TYPE_CONTACT handle of the local user on this connection,
- * or 0 if we don't know yet or if the connection has become invalid.
- *
- * This may change if the local user's unique identifier changes (for
- * instance by using /nick on IRC), in which case #GObject::notify will be
- * emitted.
- *
- * To wait for a valid self-handle (and other properties), call
- * tp_proxy_prepare_async() with the feature
- * %TP_CONNECTION_FEATURE_CONNECTED.
- *
- * Deprecated: Use #TpConnection:self-contact instead.
- */
- param_spec = g_param_spec_uint ("self-handle", "Self handle",
- "The local user's Contact handle on this connection", 0, G_MAXUINT32,
- 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_SELF_HANDLE,
- param_spec);
-
- /**
* TpConnection:self-contact:
*
* A #TpContact representing the local user on this connection,
@@ -2280,36 +2251,6 @@ _tp_connection_set_account (TpConnection *self,
}
/**
- * tp_connection_get_self_handle:
- * @self: a connection
- *
- * Return the %TP_HANDLE_TYPE_CONTACT handle of the local user on this
- * connection, or 0 if the self-handle is not known yet or the connection
- * has become invalid (the TpProxy::invalidated signal).
- *
- * The returned handle is not necessarily valid forever (the
- * notify::self-handle signal will be emitted if it changes, which can happen
- * on protocols such as IRC). Construct a #TpContact object if you want to
- * track the local user's identifier in the protocol, or other information
- * like their presence status, over time.
- *
- * Returns: the value of the TpConnection:self-handle property
- *
- * Since: 0.7.26
- * Deprecated: Use tp_connection_get_self_handle() instead.
- */
-TpHandle
-tp_connection_get_self_handle (TpConnection *self)
-{
- g_return_val_if_fail (TP_IS_CONNECTION (self), 0);
-
- if (self->priv->self_contact == NULL)
- return 0;
-
- return tp_contact_get_handle (self->priv->self_contact);
-}
-
-/**
* tp_connection_get_status:
* @self: a connection
* @reason: (out): a TpConnectionStatusReason, or %NULL
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index 34a260269..47259ddbf 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -137,11 +137,6 @@ const gchar *tp_connection_get_connection_manager_name (TpConnection *self);
const gchar *tp_connection_get_protocol_name (TpConnection *self);
-#ifndef TP_DISABLE_DEPRECATED
-_TP_DEPRECATED_IN_0_20_FOR (tp_connection_get_self_contact)
-TpHandle tp_connection_get_self_handle (TpConnection *self);
-#endif
-
TpContact *tp_connection_get_self_contact (TpConnection *self);
TpCapabilities * tp_connection_get_capabilities (TpConnection *self);
diff --git a/tests/dbus/call-channel.c b/tests/dbus/call-channel.c
index e878564ad..1caacd271 100644
--- a/tests/dbus/call-channel.c
+++ b/tests/dbus/call-channel.c
@@ -121,7 +121,8 @@ setup (Test *test,
tp_cli_connection_call_connect (test->conn, -1, NULL, NULL, NULL, NULL);
tp_tests_proxy_run_until_prepared (test->conn, conn_features);
- test->self_handle = tp_connection_get_self_handle (test->conn);
+ test->self_handle = tp_contact_get_handle (
+ tp_connection_get_self_contact (test->conn));
g_assert (test->self_handle != 0);
test->audio_request = g_array_sized_new (FALSE, FALSE, sizeof (guint), 1);
diff --git a/tests/dbus/connection.c b/tests/dbus/connection.c
index 9422d2582..de7575b81 100644
--- a/tests/dbus/connection.c
+++ b/tests/dbus/connection.c
@@ -146,7 +146,7 @@ test_prepare (Test *test,
g_assert (tp_proxy_is_prepared (test->conn, TP_CONNECTION_FEATURE_CORE));
g_assert (!tp_proxy_is_prepared (test->conn,
TP_CONNECTION_FEATURE_CONNECTED));
- g_assert_cmpuint (tp_connection_get_self_handle (test->conn), ==, 0);
+ g_assert (tp_connection_get_self_contact (test->conn) == NULL);
g_assert_cmpint (tp_connection_get_status (test->conn, NULL), ==,
TP_CONNECTION_STATUS_DISCONNECTED);
@@ -190,7 +190,7 @@ test_prepare (Test *test,
TP_CONNECTION_FEATURE_CONNECTED));
g_assert (tp_proxy_is_prepared (test->conn,
TP_CONNECTION_FEATURE_CAPABILITIES));
- g_assert_cmpuint (tp_connection_get_self_handle (test->conn), !=, 0);
+ g_assert (TP_IS_CONTACT (tp_connection_get_self_contact (test->conn)));
g_assert_cmpint (tp_connection_get_status (test->conn, &reason), ==,
TP_CONNECTION_STATUS_CONNECTED);
g_assert_cmpint (reason, ==, TP_CONNECTION_STATUS_REASON_REQUESTED);
diff --git a/tests/dbus/contacts.c b/tests/dbus/contacts.c
index 7546efe09..beb8a1e19 100644
--- a/tests/dbus/contacts.c
+++ b/tests/dbus/contacts.c
@@ -295,6 +295,7 @@ test_contact_info (Fixture *f,
gconstpointer unused G_GNUC_UNUSED)
{
TpTestsContactsConnection *service_conn = f->service_conn;
+ TpBaseConnection *service_conn_base = (TpBaseConnection *) service_conn;
TpConnection *client_conn = f->client_conn;
Result result = { g_main_loop_new (NULL, FALSE), NULL, NULL, NULL };
TpHandleRepoIface *service_repo = tp_base_connection_get_handles (
@@ -334,7 +335,7 @@ test_contact_info (Fixture *f,
/* ... but first, get the SelfHandle contact without any features (regression
* test for a related bug, fd.o #32191) */
- handle = tp_connection_get_self_handle (client_conn);
+ handle = tp_base_connection_get_self_handle (service_conn_base);
tp_connection_get_contacts_by_handle (client_conn,
1, &handle,
NULL,
@@ -350,7 +351,7 @@ test_contact_info (Fixture *f,
g_main_loop_run (result.loop);
g_assert_no_error (result.error);
- handle = tp_connection_get_self_handle (client_conn);
+ handle = tp_base_connection_get_self_handle (service_conn_base);
tp_connection_get_contacts_by_handle (client_conn,
1, &handle,
features,
diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c
index 77bb3e2e8..f989cf8c2 100644
--- a/tests/dbus/message-mixin.c
+++ b/tests/dbus/message-mixin.c
@@ -375,7 +375,7 @@ main (int argc,
MYASSERT (message_sent_count == 1, ": %u != 1", message_sent_count);
MYASSERT (message_received_count == 1, ": %u != 1", message_received_count);
g_assert_cmpuint (last_message_sent_sender, ==,
- tp_connection_get_self_handle (conn));
+ tp_contact_get_handle (tp_connection_get_self_contact (conn)));
g_assert_cmpstr (last_message_sent_sender_id, ==, "me@example.com");
MYASSERT (last_message_sent_type == TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
": %u != NORMAL", last_message_sent_type);
@@ -466,7 +466,7 @@ main (int argc,
MYASSERT (last_message_sent_type == TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
": %u != NORMAL", last_message_sent_type);
g_assert_cmpuint (last_message_sent_sender, ==,
- tp_connection_get_self_handle (conn));
+ tp_contact_get_handle (tp_connection_get_self_contact (conn)));
g_assert_cmpstr (last_message_sent_sender_id, ==, "me@example.com");
MYASSERT (last_message_sent_n_parts == 5,
": %u != 5", last_message_sent_n_parts);
@@ -539,7 +539,7 @@ main (int argc,
MYASSERT (last_message_sent_type == TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
": %u != NORMAL", last_message_sent_type);
g_assert_cmpuint (last_message_sent_sender, ==,
- tp_connection_get_self_handle (conn));
+ tp_contact_get_handle (tp_connection_get_self_contact (conn)));
g_assert_cmpstr (last_message_sent_sender_id, ==, "me@example.com");
MYASSERT (last_message_sent_n_parts == 4,
": %u != 4", last_message_sent_n_parts);
diff --git a/tests/dbus/self-handle.c b/tests/dbus/self-handle.c
index 974976e06..d43b21526 100644
--- a/tests/dbus/self-handle.c
+++ b/tests/dbus/self-handle.c
@@ -91,12 +91,9 @@ static void
test_self_handle (Fixture *f,
gconstpointer unused G_GNUC_UNUSED)
{
- TpHandle handle;
TpContact *before, *after;
- guint handle_times = 0, contact_times = 0;
+ guint contact_times = 0;
- g_signal_connect_swapped (f->client_conn, "notify::self-handle",
- G_CALLBACK (swapped_counter_cb), &handle_times);
g_signal_connect_swapped (f->client_conn, "notify::self-contact",
G_CALLBACK (swapped_counter_cb), &contact_times);
@@ -104,19 +101,13 @@ test_self_handle (Fixture *f,
tp_base_connection_get_self_handle (f->service_conn_as_base)), ==,
"me@example.com");
- g_assert_cmpuint (tp_connection_get_self_handle (f->client_conn), ==,
- tp_base_connection_get_self_handle (f->service_conn_as_base));
-
g_object_get (f->client_conn,
- "self-handle", &handle,
"self-contact", &before,
NULL);
- g_assert_cmpuint (handle, ==,
+ g_assert_cmpuint (tp_contact_get_handle (before), ==,
tp_base_connection_get_self_handle (f->service_conn_as_base));
- g_assert_cmpuint (tp_contact_get_handle (before), ==, handle);
g_assert_cmpstr (tp_contact_get_identifier (before), ==, "me@example.com");
- g_assert_cmpuint (handle_times, ==, 0);
g_assert_cmpuint (contact_times, ==, 0);
/* similar to /nick in IRC */
@@ -124,27 +115,21 @@ test_self_handle (Fixture *f,
"myself@example.org");
tp_tests_proxy_run_until_dbus_queue_processed (f->client_conn);
- while (handle_times < 1 || contact_times < 1)
+ while (contact_times < 1)
g_main_context_iteration (NULL, TRUE);
- g_assert_cmpuint (handle_times, ==, 1);
g_assert_cmpuint (contact_times, ==, 1);
g_assert_cmpstr (tp_handle_inspect (f->contact_repo,
tp_base_connection_get_self_handle (f->service_conn_as_base)), ==,
"myself@example.org");
- g_assert_cmpuint (tp_connection_get_self_handle (f->client_conn), ==,
- tp_base_connection_get_self_handle (f->service_conn_as_base));
-
g_object_get (f->client_conn,
- "self-handle", &handle,
"self-contact", &after,
NULL);
g_assert (before != after);
- g_assert_cmpuint (handle, ==,
+ g_assert_cmpuint (tp_contact_get_handle (after), ==,
tp_base_connection_get_self_handle (f->service_conn_as_base));
- g_assert_cmpuint (tp_contact_get_handle (after), ==, handle);
g_assert_cmpstr (tp_contact_get_identifier (after), ==,
"myself@example.org");
@@ -156,14 +141,11 @@ static void
test_change_early (Fixture *f,
gconstpointer unused G_GNUC_UNUSED)
{
- TpHandle handle;
TpContact *after;
- guint handle_times = 0, contact_times = 0;
+ guint contact_times = 0;
gboolean ok;
GQuark features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 };
- g_signal_connect_swapped (f->client_conn, "notify::self-handle",
- G_CALLBACK (swapped_counter_cb), &handle_times);
g_signal_connect_swapped (f->client_conn, "notify::self-contact",
G_CALLBACK (swapped_counter_cb), &contact_times);
@@ -198,19 +180,13 @@ test_change_early (Fixture *f,
g_assert (ok);
/* the self-handle and self-contact change once during connection */
- g_assert_cmpuint (handle_times, ==, 1);
g_assert_cmpuint (contact_times, ==, 1);
- g_assert_cmpuint (tp_connection_get_self_handle (f->client_conn), ==,
- tp_base_connection_get_self_handle (f->service_conn_as_base));
-
g_object_get (f->client_conn,
- "self-handle", &handle,
"self-contact", &after,
NULL);
- g_assert_cmpuint (handle, ==,
+ g_assert_cmpuint (tp_contact_get_handle (after), ==,
tp_base_connection_get_self_handle (f->service_conn_as_base));
- g_assert_cmpuint (tp_contact_get_handle (after), ==, handle);
g_assert_cmpstr (tp_contact_get_identifier (after), ==,
"myself@example.org");