summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/cm/call/call-channel.c2
-rw-r--r--examples/cm/call/call-manager.c14
-rw-r--r--examples/cm/call/conn.c17
-rw-r--r--examples/cm/channelspecific/conn.c7
-rw-r--r--examples/cm/channelspecific/room-manager.c5
-rw-r--r--examples/cm/channelspecific/room.c9
-rw-r--r--examples/cm/contactlist/conn.c19
-rw-r--r--examples/cm/echo-message-parts/conn.c5
-rw-r--r--examples/cm/echo-message-parts/im-manager.c5
-rw-r--r--examples/cm/extended/conn.c10
-rw-r--r--telepathy-glib/base-channel.c2
-rw-r--r--telepathy-glib/base-contact-list.c18
-rw-r--r--telepathy-glib/base-password-channel.c3
-rw-r--r--telepathy-glib/contact-list-channel.c3
-rw-r--r--telepathy-glib/contacts-mixin.c2
-rw-r--r--telepathy-glib/presence-mixin.c6
-rw-r--r--telepathy-glib/simple-password-manager.c4
-rw-r--r--tests/dbus/channel-introspect.c6
-rw-r--r--tests/dbus/channel-request.c5
-rw-r--r--tests/dbus/contacts-slow-path.c3
-rw-r--r--tests/dbus/contacts.c3
-rw-r--r--tests/lib/bug-19101-conn.c3
-rw-r--r--tests/lib/bug16307-conn.c20
-rw-r--r--tests/lib/contact-list-manager.c5
-rw-r--r--tests/lib/contacts-conn.c9
-rw-r--r--tests/lib/echo-conn.c4
-rw-r--r--tests/lib/echo-im-manager.c6
-rw-r--r--tests/lib/simple-channel-manager.c3
-rw-r--r--tests/lib/simple-channel-request.c6
-rw-r--r--tests/lib/simple-conn.c23
-rw-r--r--tests/lib/textchan-group.c9
-rw-r--r--tests/lib/textchan-null.c6
32 files changed, 139 insertions, 103 deletions
diff --git a/examples/cm/call/call-channel.c b/examples/cm/call/call-channel.c
index 1ae680669..456bc490f 100644
--- a/examples/cm/call/call-channel.c
+++ b/examples/cm/call/call-channel.c
@@ -521,7 +521,7 @@ example_call_channel_add_content (ExampleCallChannel *self,
if (locally_requested)
{
g_message ("SIGNALLING: send: new %s stream %s", type_str, name);
- creator = self->priv->conn->self_handle;
+ creator = tp_base_connection_get_self_handle (self->priv->conn);
}
path = g_strdup_printf ("%s/Content%u",
diff --git a/examples/cm/call/call-manager.c b/examples/cm/call/call-manager.c
index f637f2b41..ed8464087 100644
--- a/examples/cm/call/call-manager.c
+++ b/examples/cm/call/call-manager.c
@@ -320,14 +320,15 @@ new_channel (ExampleCallManager *self,
/* FIXME: This could potentially wrap around, but only after 4 billion
* calls, which is probably plenty. */
object_path = g_strdup_printf ("%s/CallChannel%u",
- self->priv->conn->object_path, self->priv->next_channel_index++);
+ tp_base_connection_get_object_path (self->priv->conn),
+ self->priv->next_channel_index++);
chan = g_object_new (EXAMPLE_TYPE_CALL_CHANNEL,
"connection", self->priv->conn,
"object-path", object_path,
"handle", handle,
- "initiator-handle", initiator,
- "requested", (self->priv->conn->self_handle == initiator),
+ "initiator-handle",
+ (tp_base_connection_get_self_handle (self->priv->conn) == initiator),
"simulation-delay", self->priv->simulation_delay,
"initial-audio", initial_audio,
"initial-video", initial_video,
@@ -448,7 +449,7 @@ example_call_manager_request (ExampleCallManager *self,
goto error;
}
- if (handle == self->priv->conn->self_handle)
+ if (handle == tp_base_connection_get_self_handle (self->priv->conn))
{
/* In protocols with a concept of multiple "resources" signed in to
* one account (XMPP, and possibly MSN) it is technically possible to
@@ -486,8 +487,9 @@ example_call_manager_request (ExampleCallManager *self,
}
}
- new_channel (self, handle, self->priv->conn->self_handle, request_token,
- initial_audio, initial_video);
+ new_channel (self, handle,
+ tp_base_connection_get_self_handle (self->priv->conn),
+ request_token, initial_audio, initial_video);
return TRUE;
error:
diff --git a/examples/cm/call/conn.c b/examples/cm/call/conn.c
index fbe885d75..720cbf13f 100644
--- a/examples/cm/call/conn.c
+++ b/examples/cm/call/conn.c
@@ -184,17 +184,20 @@ start_connecting (TpBaseConnection *conn,
ExampleCallConnection *self = EXAMPLE_CALL_CONNECTION (conn);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
/* In a real connection manager we'd ask the underlying implementation to
* start connecting, then go to state CONNECTED when finished, but here
* we can do it immediately. */
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, error);
- if (conn->self_handle == 0)
+ if (self_handle == 0)
return FALSE;
+ tp_base_connection_set_self_handle (conn, self_handle);
+
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
@@ -235,10 +238,7 @@ status_available (GObject *object,
{
TpBaseConnection *base = TP_BASE_CONNECTION (object);
- if (base->status != TP_CONNECTION_STATUS_CONNECTED)
- return FALSE;
-
- return TRUE;
+ return tp_base_connection_check_connected (base, NULL);
}
static GHashTable *
@@ -264,7 +264,7 @@ get_contact_statuses (GObject *object,
/* we know our own status from the connection; for this example CM,
* everyone else's status is assumed to be "available" */
- if (contact == base->self_handle)
+ if (contact == tp_base_connection_get_self_handle (base))
{
presence = (self->priv->away ? EXAMPLE_CALL_PRESENCE_AWAY
: EXAMPLE_CALL_PRESENCE_AVAILABLE);
@@ -332,7 +332,8 @@ set_own_status (GObject *object,
presences = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, NULL);
- g_hash_table_insert (presences, GUINT_TO_POINTER (base->self_handle),
+ g_hash_table_insert (presences,
+ GUINT_TO_POINTER (tp_base_connection_get_self_handle (base)),
(gpointer) status);
tp_presence_mixin_emit_presence_update (object, presences);
g_hash_table_unref (presences);
diff --git a/examples/cm/channelspecific/conn.c b/examples/cm/channelspecific/conn.c
index f7957cc46..59dba2707 100644
--- a/examples/cm/channelspecific/conn.c
+++ b/examples/cm/channelspecific/conn.c
@@ -189,17 +189,20 @@ start_connecting (TpBaseConnection *conn,
ExampleCSHConnection *self = EXAMPLE_CSH_CONNECTION (conn);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
/* In a real connection manager we'd ask the underlying implementation to
* start connecting, then go to state CONNECTED when finished, but here
* we can do it immediately. */
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, error);
- if (conn->self_handle == 0)
+ if (self_handle == 0)
return FALSE;
+ tp_base_connection_set_self_handle (conn, self_handle);
+
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
diff --git a/examples/cm/channelspecific/room-manager.c b/examples/cm/channelspecific/room-manager.c
index 5aa164419..a5c535ea2 100644
--- a/examples/cm/channelspecific/room-manager.c
+++ b/examples/cm/channelspecific/room-manager.c
@@ -235,7 +235,7 @@ new_channel (ExampleCSHRoomManager *self,
GSList *requests = NULL;
object_path = g_strdup_printf ("%s/CSHRoomChannel%u",
- self->priv->conn->object_path, handle);
+ tp_base_connection_get_object_path (self->priv->conn), handle);
chan = g_object_new (EXAMPLE_TYPE_CSH_ROOM_CHANNEL,
"connection", self->priv->conn,
@@ -323,7 +323,8 @@ example_csh_room_manager_request (ExampleCSHRoomManager *self,
if (chan == NULL)
{
- new_channel (self, handle, self->priv->conn->self_handle,
+ new_channel (self, handle,
+ tp_base_connection_get_self_handle (self->priv->conn),
request_token);
}
else if (require_new)
diff --git a/examples/cm/channelspecific/room.c b/examples/cm/channelspecific/room.c
index c701f5ae7..45c8614d4 100644
--- a/examples/cm/channelspecific/room.c
+++ b/examples/cm/channelspecific/room.c
@@ -69,7 +69,8 @@ suggest_room_identity (ExampleCSHRoomChannel *self)
gchar *nick, *id;
TpHandle ret;
- nick = g_strdup (tp_handle_inspect (contact_repo, connection->self_handle));
+ nick = g_strdup (tp_handle_inspect (contact_repo,
+ tp_base_connection_get_self_handle (connection)));
g_strdelimit (nick, "@", '\0');
id = g_strdup_printf ("%s@%s", nick, tp_handle_inspect (room_repo,
tp_base_channel_get_target_handle (TP_BASE_CHANNEL (self))));
@@ -143,7 +144,7 @@ complete_join (ExampleCSHRoomChannel *self)
tp_intset_add (removed, mixin->self_handle);
tp_group_mixin_add_handle_owner ((GObject *) self, new_self,
- conn->self_handle);
+ tp_base_connection_get_self_handle (conn));
tp_group_mixin_change_self_handle ((GObject *) self, new_self);
tp_group_mixin_change_members ((GObject *) self, "", NULL, removed, NULL,
@@ -199,9 +200,9 @@ join_room (ExampleCSHRoomChannel *self)
tp_intset_add (add_remote_pending, mixin->self_handle);
tp_group_mixin_add_handle_owner (object, mixin->self_handle,
- conn->self_handle);
+ tp_base_connection_get_self_handle (conn));
tp_group_mixin_change_members (object, "", NULL, NULL, NULL,
- add_remote_pending, conn->self_handle,
+ add_remote_pending, tp_base_connection_get_self_handle (conn),
TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
tp_intset_destroy (add_remote_pending);
diff --git a/examples/cm/contactlist/conn.c b/examples/cm/contactlist/conn.c
index 2317eda4c..ab4507740 100644
--- a/examples/cm/contactlist/conn.c
+++ b/examples/cm/contactlist/conn.c
@@ -190,7 +190,7 @@ presence_updated_cb (ExampleContactList *contact_list,
TpPresenceStatus *status;
/* we ignore the presence indicated by the contact list for our own handle */
- if (contact == base->self_handle)
+ if (contact == tp_base_connection_get_self_handle (base))
return;
status = tp_presence_status_new (
@@ -231,17 +231,20 @@ start_connecting (TpBaseConnection *conn,
ExampleContactListConnection *self = EXAMPLE_CONTACT_LIST_CONNECTION (conn);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
/* In a real connection manager we'd ask the underlying implementation to
* start connecting, then go to state CONNECTED when finished, but here
* we can do it immediately. */
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, error);
- if (conn->self_handle == 0)
+ if (self_handle == 0)
return FALSE;
+ tp_base_connection_set_self_handle (conn, self_handle);
+
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
@@ -309,10 +312,7 @@ status_available (GObject *object,
{
TpBaseConnection *base = TP_BASE_CONNECTION (object);
- if (base->status != TP_CONNECTION_STATUS_CONNECTED)
- return FALSE;
-
- return TRUE;
+ return tp_base_connection_check_connected (base, NULL);
}
static GHashTable *
@@ -335,7 +335,7 @@ get_contact_statuses (GObject *object,
/* we get our own status from the connection, and everyone else's status
* from the contact lists */
- if (contact == base->self_handle)
+ if (contact == tp_base_connection_get_self_handle (base))
{
presence = (self->priv->away ? EXAMPLE_CONTACT_LIST_PRESENCE_AWAY
: EXAMPLE_CONTACT_LIST_PRESENCE_AVAILABLE);
@@ -383,7 +383,8 @@ set_own_status (GObject *object,
presences = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, NULL);
- g_hash_table_insert (presences, GUINT_TO_POINTER (base->self_handle),
+ g_hash_table_insert (presences,
+ GUINT_TO_POINTER (tp_base_connection_get_self_handle (base)),
(gpointer) status);
tp_presence_mixin_emit_presence_update (object, presences);
g_hash_table_unref (presences);
diff --git a/examples/cm/echo-message-parts/conn.c b/examples/cm/echo-message-parts/conn.c
index 7e6e4c0ec..d93229f15 100644
--- a/examples/cm/echo-message-parts/conn.c
+++ b/examples/cm/echo-message-parts/conn.c
@@ -133,14 +133,17 @@ start_connecting (TpBaseConnection *conn,
ExampleEcho2Connection *self = EXAMPLE_ECHO_2_CONNECTION (conn);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
/* In a real connection manager we'd ask the underlying implementation to
* start connecting, then go to state CONNECTED when finished, but here
* we can do it immediately. */
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, NULL);
+ tp_base_connection_set_self_handle (conn, self_handle);
+
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
diff --git a/examples/cm/echo-message-parts/im-manager.c b/examples/cm/echo-message-parts/im-manager.c
index 6451fb8f8..5a8153717 100644
--- a/examples/cm/echo-message-parts/im-manager.c
+++ b/examples/cm/echo-message-parts/im-manager.c
@@ -231,7 +231,7 @@ new_channel (ExampleEcho2ImManager *self,
GSList *requests = NULL;
object_path = g_strdup_printf ("%s/Echo2Channel%u",
- self->priv->conn->object_path, handle);
+ tp_base_connection_get_object_path (self->priv->conn), handle);
chan = g_object_new (EXAMPLE_TYPE_ECHO_2_CHANNEL,
"connection", self->priv->conn,
@@ -319,7 +319,8 @@ example_echo_2_im_manager_request (ExampleEcho2ImManager *self,
if (chan == NULL)
{
- new_channel (self, handle, self->priv->conn->self_handle,
+ new_channel (self, handle,
+ tp_base_connection_get_self_handle (self->priv->conn),
request_token);
}
else if (require_new)
diff --git a/examples/cm/extended/conn.c b/examples/cm/extended/conn.c
index 69e99cc0b..8b2560564 100644
--- a/examples/cm/extended/conn.c
+++ b/examples/cm/extended/conn.c
@@ -148,14 +148,17 @@ start_connecting (TpBaseConnection *conn,
ExampleExtendedConnection *self = EXAMPLE_EXTENDED_CONNECTION (conn);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
/* In a real connection manager we'd ask the underlying implementation to
* start connecting, then go to state CONNECTED when finished, but here
* we can do it immediately. */
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, NULL);
+ tp_base_connection_set_self_handle (conn, self_handle);
+
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
@@ -274,7 +277,7 @@ my_get_hats (ExampleSvcConnectionInterfaceHats *iface,
/* for the sake of a simple example, let's assume nobody except me
* has any hats */
- if (handle == base->self_handle)
+ if (handle == tp_base_connection_get_self_handle (base))
{
g_value_set_string (g_value_array_get_nth (vals, 1),
self->priv->hat_color);
@@ -320,7 +323,8 @@ my_set_hat (ExampleSvcConnectionInterfaceHats *iface,
/* success */
example_svc_connection_interface_hats_emit_hats_changed (self,
- base->self_handle, color, style, properties);
+ tp_base_connection_get_self_handle (base),
+ color, style, properties);
example_svc_connection_interface_hats_return_from_set_hat (context);
}
diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c
index 61d433050..c05db171e 100644
--- a/telepathy-glib/base-channel.c
+++ b/telepathy-glib/base-channel.c
@@ -654,7 +654,7 @@ tp_base_channel_constructed (GObject *object)
g_assert (*base_path != '\0');
chan->priv->object_path = g_strdup_printf ("%s/%s",
- conn->object_path, base_path);
+ tp_base_connection_get_object_path (conn), base_path);
g_free (base_path);
}
}
diff --git a/telepathy-glib/base-contact-list.c b/telepathy-glib/base-contact-list.c
index bcf1a9cf5..107b4c11c 100644
--- a/telepathy-glib/base-contact-list.c
+++ b/telepathy-glib/base-contact-list.c
@@ -1082,7 +1082,7 @@ tp_base_contact_list_new_channel (TpBaseContactList *self,
if (handle_type == TP_HANDLE_TYPE_LIST)
{
object_path = g_strdup_printf ("%s/ContactList/%s",
- self->priv->conn->object_path,
+ tp_base_connection_get_object_path (self->priv->conn),
tp_base_contact_list_contact_lists[handle - 1]);
type = TP_TYPE_CONTACT_LIST_CHANNEL;
}
@@ -1090,7 +1090,7 @@ tp_base_contact_list_new_channel (TpBaseContactList *self,
{
g_assert (handle_type == TP_HANDLE_TYPE_GROUP);
object_path = g_strdup_printf ("%s/Group/%u",
- self->priv->conn->object_path, handle);
+ tp_base_connection_get_object_path (self->priv->conn), handle);
type = TP_TYPE_CONTACT_GROUP_CHANNEL;
}
@@ -3838,7 +3838,7 @@ tp_base_contact_list_groups_removed (TpBaseContactList *self,
* actor. */
tp_group_mixin_change_members (c, "",
NULL, tp_handle_set_peek (group_members), NULL, NULL,
- self->priv->conn->self_handle,
+ tp_base_connection_get_self_handle (self->priv->conn),
TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
tp_channel_manager_emit_channel_closed_for_object (self, c);
@@ -3955,12 +3955,14 @@ tp_base_contact_list_group_renamed (TpBaseContactList *self,
/* move the members - presumably the self-handle is the actor */
set = tp_handle_set_peek (old_members);
tp_group_mixin_change_members (new_chan, "", set, NULL, NULL, NULL,
- self->priv->conn->self_handle, TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
+ tp_base_connection_get_self_handle (self->priv->conn),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
if (old_chan != NULL)
{
tp_group_mixin_change_members (old_chan, "", NULL, set, NULL, NULL,
- self->priv->conn->self_handle, TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
+ tp_base_connection_get_self_handle (self->priv->conn),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
tp_channel_manager_emit_channel_closed_for_object (self, old_chan);
_tp_base_contact_list_channel_close (old_chan);
}
@@ -4118,7 +4120,8 @@ tp_base_contact_list_groups_changed (TpBaseContactList *self,
if (tp_group_mixin_change_members (c, "",
tp_handle_set_peek (contacts), NULL, NULL, NULL,
- self->priv->conn->self_handle, TP_CHANNEL_GROUP_CHANGE_REASON_NONE))
+ tp_base_connection_get_self_handle (self->priv->conn),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE))
g_ptr_array_add (really_added, (gchar *) added[i]);
}
@@ -4143,7 +4146,8 @@ tp_base_contact_list_groups_changed (TpBaseContactList *self,
if (tp_group_mixin_change_members (c, "",
NULL, tp_handle_set_peek (contacts), NULL, NULL,
- self->priv->conn->self_handle, TP_CHANNEL_GROUP_CHANGE_REASON_NONE))
+ tp_base_connection_get_self_handle (self->priv->conn),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE))
g_ptr_array_add (really_removed, (gchar *) removed[i]);
}
diff --git a/telepathy-glib/base-password-channel.c b/telepathy-glib/base-password-channel.c
index d5a246abf..7ca4ca270 100644
--- a/telepathy-glib/base-password-channel.c
+++ b/telepathy-glib/base-password-channel.c
@@ -160,7 +160,8 @@ tp_base_password_channel_constructed (GObject *obj)
priv->sasl_error_details = tp_asv_new (NULL, NULL);
priv->authorization_identity = g_strdup (
- tp_handle_inspect (contact_handles, base_conn->self_handle));
+ tp_handle_inspect (contact_handles,
+ tp_base_connection_get_self_handle (base_conn)));
priv->default_username = g_strdup (priv->authorization_identity);
priv->default_realm = g_strdup ("");
}
diff --git a/telepathy-glib/contact-list-channel.c b/telepathy-glib/contact-list-channel.c
index 6346da8b3..7344ec04d 100644
--- a/telepathy-glib/contact-list-channel.c
+++ b/telepathy-glib/contact-list-channel.c
@@ -110,7 +110,8 @@ tp_base_contact_list_channel_constructed (GObject *object)
tp_base_channel_register (base);
tp_group_mixin_init (object, G_STRUCT_OFFSET (TpBaseContactListChannel,
- group), contact_repo, conn->self_handle);
+ group), contact_repo,
+ tp_base_connection_get_self_handle (conn));
/* Both the subclasses have full support for telepathy-spec 0.17.6. */
tp_group_mixin_change_flags (object,
TP_CHANNEL_GROUP_FLAG_PROPERTIES, 0);
diff --git a/telepathy-glib/contacts-mixin.c b/telepathy-glib/contacts-mixin.c
index 90cadc6d9..9b95803cd 100644
--- a/telepathy-glib/contacts-mixin.c
+++ b/telepathy-glib/contacts-mixin.c
@@ -309,7 +309,7 @@ tp_contacts_mixin_get_contact_attributes (GObject *obj,
g_return_val_if_fail (TP_IS_BASE_CONNECTION (obj), NULL);
g_return_val_if_fail (TP_CONTACTS_MIXIN_OFFSET (obj) != 0, NULL);
- g_return_val_if_fail (conn->status == TP_CONNECTION_STATUS_CONNECTED, NULL);
+ g_return_val_if_fail (tp_base_connection_check_connected (conn, NULL), NULL);
/* Setup handle array and hash with valid handles, optionally holding them */
valid_handles = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle),
diff --git a/telepathy-glib/presence-mixin.c b/telepathy-glib/presence-mixin.c
index 7a4e8dcfe..f3b3b8787 100644
--- a/telepathy-glib/presence-mixin.c
+++ b/telepathy-glib/presence-mixin.c
@@ -927,13 +927,15 @@ tp_presence_mixin_remove_status (TpSvcConnectionInterfacePresence *iface,
GError *error = NULL;
GHashTable *self_contact_statuses;
TpPresenceStatus *self_status;
+ TpHandle self_handle;
DEBUG ("called.");
TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (conn, context);
self_contacts = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle), 1);
- g_array_append_val (self_contacts, conn->self_handle);
+ self_handle = tp_base_connection_get_self_handle (conn);
+ g_array_append_val (self_contacts, self_handle);
self_contact_statuses = mixin_cls->get_contact_statuses (obj, self_contacts,
&error);
@@ -946,7 +948,7 @@ tp_presence_mixin_remove_status (TpSvcConnectionInterfacePresence *iface,
}
self_status = (TpPresenceStatus *) g_hash_table_lookup (self_contact_statuses,
- GUINT_TO_POINTER (conn->self_handle));
+ GUINT_TO_POINTER (tp_base_connection_get_self_handle (conn)));
if (!self_status)
{
diff --git a/telepathy-glib/simple-password-manager.c b/telepathy-glib/simple-password-manager.c
index 9aedb5de2..4239a9a4c 100644
--- a/telepathy-glib/simple-password-manager.c
+++ b/telepathy-glib/simple-password-manager.c
@@ -430,7 +430,7 @@ tp_simple_password_manager_prompt_async (
{
TpSimplePasswordManagerPrivate *priv = self->priv;
gchar *object_path = g_strdup_printf ("%s/BasePasswordChannel",
- priv->conn->object_path);
+ tp_base_connection_get_object_path (priv->conn));
TpBasePasswordChannel *channel;
GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (self),
callback, user_data, tp_simple_password_manager_prompt_async);
@@ -440,7 +440,7 @@ tp_simple_password_manager_prompt_async (
"object-path", object_path,
"handle", 0,
"requested", FALSE,
- "initiator-handle", priv->conn->self_handle,
+ "initiator-handle", tp_base_connection_get_self_handle (priv->conn),
NULL);
tp_simple_password_manager_prompt_common_async (self, channel, result);
diff --git a/tests/dbus/channel-introspect.c b/tests/dbus/channel-introspect.c
index 3b56218b7..072cf69e5 100644
--- a/tests/dbus/channel-introspect.c
+++ b/tests/dbus/channel-introspect.c
@@ -374,8 +374,10 @@ main (int argc,
g_object_unref (prepare_result);
prepare_result = NULL;
- assert_chan_sane (chan, handle, TRUE, service_conn_as_base->self_handle,
- tp_handle_inspect (contact_repo, service_conn_as_base->self_handle));
+ assert_chan_sane (chan, handle, TRUE,
+ tp_base_connection_get_self_handle (service_conn_as_base),
+ tp_handle_inspect (contact_repo,
+ tp_base_connection_get_self_handle (service_conn_as_base)));
/* no way to see what this is doing - just make sure it doesn't crash */
tp_proxy_prepare_async (chan, some_features, NULL, NULL);
diff --git a/tests/dbus/channel-request.c b/tests/dbus/channel-request.c
index 5afe9a633..5d8318267 100644
--- a/tests/dbus/channel-request.c
+++ b/tests/dbus/channel-request.c
@@ -223,7 +223,7 @@ succeeded_with_channel_cb (TpChannelRequest *request,
g_assert (TP_IS_CHANNEL (channel));
g_assert_cmpstr (tp_proxy_get_object_path (connection), ==,
- test->base_connection->object_path);
+ tp_base_connection_get_object_path (test->base_connection));
g_assert_cmpstr (tp_proxy_get_object_path (channel), ==,
"/Channel");
@@ -256,7 +256,8 @@ test_succeeded (Test *test,
props = g_hash_table_new (NULL, NULL);
tp_svc_channel_request_emit_succeeded_with_channel (test->cr_service,
- test->base_connection->object_path, props, "/Channel", props);
+ tp_base_connection_get_object_path (test->base_connection),
+ props, "/Channel", props);
g_hash_table_unref (props);
diff --git a/tests/dbus/contacts-slow-path.c b/tests/dbus/contacts-slow-path.c
index fa4b454e2..b7094c0e2 100644
--- a/tests/dbus/contacts-slow-path.c
+++ b/tests/dbus/contacts-slow-path.c
@@ -1096,7 +1096,8 @@ test_by_handle_again (Fixture *f,
/* OK, put it back so teardown() can use it */
tp_dbus_daemon_register_object (
tp_base_connection_get_dbus_daemon (f->base_connection),
- f->base_connection->object_path, f->base_connection);
+ tp_base_connection_get_object_path (f->base_connection),
+ f->base_connection);
/* check that *that* worked */
ok = tp_cli_connection_run_get_self_handle (f->legacy_client_conn, -1, NULL,
&result.error, NULL);
diff --git a/tests/dbus/contacts.c b/tests/dbus/contacts.c
index 3e6d7fd54..48debb035 100644
--- a/tests/dbus/contacts.c
+++ b/tests/dbus/contacts.c
@@ -901,7 +901,8 @@ put_the_connection_back (Fixture *f)
tp_dbus_daemon_register_object (
tp_base_connection_get_dbus_daemon (f->base_connection),
- f->base_connection->object_path, f->base_connection);
+ tp_base_connection_get_object_path (f->base_connection),
+ f->base_connection);
/* check that *that* worked */
ok = tp_cli_connection_run_get_self_handle (f->client_conn, -1, NULL,
&error, NULL);
diff --git a/tests/lib/bug-19101-conn.c b/tests/lib/bug-19101-conn.c
index e13b39745..bac600cf3 100644
--- a/tests/lib/bug-19101-conn.c
+++ b/tests/lib/bug-19101-conn.c
@@ -55,7 +55,8 @@ tp_tests_bug19101_connection_get_contact_attributes (
};
if (handles->len == 1 &&
- g_array_index (handles, TpHandle, 0) == base_conn->self_handle)
+ g_array_index (handles, TpHandle, 0) ==
+ tp_base_connection_get_self_handle (base_conn))
{
DEBUG ("called for self-handle (during preparation), not being rubbish");
/* strictly speaking this should hold the handles on behalf of the
diff --git a/tests/lib/bug16307-conn.c b/tests/lib/bug16307-conn.c
index 3320bd389..cbabf7393 100644
--- a/tests/lib/bug16307-conn.c
+++ b/tests/lib/bug16307-conn.c
@@ -78,14 +78,16 @@ pretend_connected (gpointer data)
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
gchar *account;
+ TpHandle self_handle;
g_object_get (self, "account", &account, NULL);
- conn->self_handle = tp_handle_ensure (contact_repo, account,
+ self_handle = tp_handle_ensure (contact_repo, account,
NULL, NULL);
g_free (account);
+ tp_base_connection_set_self_handle (conn, self_handle);
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
@@ -117,16 +119,8 @@ tp_tests_bug16307_connection_inject_get_status_return (TpTestsBug16307Connection
context = self->priv->get_status_invocation;
g_assert (context != NULL);
- if (self_base->status == TP_INTERNAL_CONNECTION_STATUS_NEW)
- {
- tp_svc_connection_return_from_get_status (
- context, TP_CONNECTION_STATUS_DISCONNECTED);
- }
- else
- {
- tp_svc_connection_return_from_get_status (
- context, self_base->status);
- }
+ tp_svc_connection_return_from_get_status (context,
+ tp_base_connection_get_status (self_base));
self->priv->get_status_invocation = NULL;
}
@@ -194,8 +188,8 @@ tp_tests_bug16307_connection_get_status (TpSvcConnection *iface,
TpTestsBug16307Connection *self = TP_TESTS_BUG16307_CONNECTION (iface);
/* auto-connect on get_status */
- if ((self_base->status == TP_INTERNAL_CONNECTION_STATUS_NEW ||
- self_base->status == TP_CONNECTION_STATUS_DISCONNECTED))
+ if (tp_base_connection_get_status (self_base) ==
+ TP_CONNECTION_STATUS_DISCONNECTED)
{
pretend_connected (self);
}
diff --git a/tests/lib/contact-list-manager.c b/tests/lib/contact-list-manager.c
index 6d0128219..b816673a5 100644
--- a/tests/lib/contact-list-manager.c
+++ b/tests/lib/contact-list-manager.c
@@ -881,8 +881,9 @@ tp_tests_contact_list_manager_add_initial_contacts (TpTestsContactListManager *s
TpHandleSet *handles;
guint i;
- g_assert_cmpint (self->priv->conn->status, ==,
- TP_INTERNAL_CONNECTION_STATUS_NEW);
+ g_assert_cmpint (tp_base_connection_get_status (self->priv->conn), ==,
+ TP_CONNECTION_STATUS_DISCONNECTED);
+ g_assert (!tp_base_connection_is_destroyed (self->priv->conn));
handles = tp_handle_set_new (self->priv->contact_repo);
for (i = 0; i < n_members; i++)
diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c
index ea974bf93..6f3088093 100644
--- a/tests/lib/contacts-conn.c
+++ b/tests/lib/contacts-conn.c
@@ -454,10 +454,7 @@ my_status_available (GObject *object,
{
TpBaseConnection *base = TP_BASE_CONNECTION (object);
- if (base->status != TP_CONNECTION_STATUS_CONNECTED)
- return FALSE;
-
- return TRUE;
+ return tp_base_connection_check_connected (base, NULL);
}
static GHashTable *
@@ -506,6 +503,7 @@ my_set_own_status (GObject *object,
TpBaseConnection *base_conn = TP_BASE_CONNECTION (object);
TpTestsContactsConnectionPresenceStatusIndex index = status->index;
const gchar *message = "";
+ TpHandle self_handle;
if (status->optional_arguments != NULL)
{
@@ -515,8 +513,9 @@ my_set_own_status (GObject *object,
message = "";
}
+ self_handle = tp_base_connection_get_self_handle (base_conn);
tp_tests_contacts_connection_change_presences (TP_TESTS_CONTACTS_CONNECTION (object),
- 1, &(base_conn->self_handle), &index, &message);
+ 1, &self_handle, &index, &message);
return TRUE;
}
diff --git a/tests/lib/echo-conn.c b/tests/lib/echo-conn.c
index 963363e02..3c63582e9 100644
--- a/tests/lib/echo-conn.c
+++ b/tests/lib/echo-conn.c
@@ -150,14 +150,16 @@ start_connecting (TpBaseConnection *conn,
TpTestsEchoConnection *self = TP_TESTS_ECHO_CONNECTION (conn);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
/* In a real connection manager we'd ask the underlying implementation to
* start connecting, then go to state CONNECTED when finished, but here
* we can do it immediately. */
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, NULL);
+ tp_base_connection_set_self_handle (conn, self_handle);
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
diff --git a/tests/lib/echo-im-manager.c b/tests/lib/echo-im-manager.c
index 1810f9264..1e9fcecc7 100644
--- a/tests/lib/echo-im-manager.c
+++ b/tests/lib/echo-im-manager.c
@@ -233,7 +233,7 @@ new_channel (TpTestsEchoImManager *self,
GSList *requests = NULL;
object_path = g_strdup_printf ("%s/EchoChannel%u",
- self->priv->conn->object_path, handle);
+ tp_base_connection_get_object_path (self->priv->conn), handle);
chan = g_object_new (TP_TESTS_TYPE_ECHO_CHANNEL,
"connection", self->priv->conn,
@@ -323,7 +323,9 @@ tp_tests_echo_im_manager_request (TpTestsEchoImManager *self,
if (chan == NULL)
{
- new_channel (self, handle, self->priv->conn->self_handle, request_token);
+ new_channel (self, handle,
+ tp_base_connection_get_self_handle (self->priv->conn),
+ request_token);
}
else if (require_new)
{
diff --git a/tests/lib/simple-channel-manager.c b/tests/lib/simple-channel-manager.c
index 28cb6a9a6..7d33f1be6 100644
--- a/tests/lib/simple-channel-manager.c
+++ b/tests/lib/simple-channel-manager.c
@@ -63,7 +63,8 @@ tp_tests_simple_channel_manager_request (TpChannelManager *manager,
tokens = g_slist_append (NULL, request_token);
- path = g_strdup_printf ("%s/Channel", self->conn->object_path);
+ path = g_strdup_printf ("%s/Channel",
+ tp_base_connection_get_object_path (self->conn));
channel = tp_tests_object_new_static_class (
TP_TESTS_TYPE_ECHO_CHANNEL,
diff --git a/tests/lib/simple-channel-request.c b/tests/lib/simple-channel-request.c
index 0f587a528..c97253099 100644
--- a/tests/lib/simple-channel-request.c
+++ b/tests/lib/simple-channel-request.c
@@ -205,7 +205,8 @@ tp_tests_simple_channel_request_proceed (TpSvcChannelRequest *request,
props = g_hash_table_new (NULL, NULL);
tp_svc_channel_request_emit_succeeded_with_channel (self,
- base_conn->object_path, props, "/chan", props);
+ tp_base_connection_get_object_path (base_conn),
+ props, "/chan", props);
tp_svc_channel_request_emit_succeeded (self);
g_hash_table_unref (props);
@@ -255,7 +256,8 @@ tp_tests_simple_channel_request_proceed (TpSvcChannelRequest *request,
NULL);
tp_cli_client_handler_call_handle_channels (client, -1,
- self->priv->account_path, base_conn->object_path, channels,
+ self->priv->account_path,
+ tp_base_connection_get_object_path (base_conn), channels,
satisfied, self->priv->user_action_time, info, handle_channels_cb, NULL,
NULL, G_OBJECT (self));
diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c
index 51bf9e232..e6ee214ef 100644
--- a/tests/lib/simple-conn.c
+++ b/tests/lib/simple-conn.c
@@ -99,12 +99,8 @@ get_property (GObject *object,
}
else
{
- guint32 status = TP_BASE_CONNECTION (self)->status;
-
- if (status == TP_INTERNAL_CONNECTION_STATUS_NEW)
- g_value_set_uint (value, TP_CONNECTION_STATUS_DISCONNECTED);
- else
- g_value_set_uint (value, status);
+ g_value_set_uint (value,
+ tp_base_connection_get_status (TP_BASE_CONNECTION (self)));
}
break;
default:
@@ -227,11 +223,13 @@ pretend_connected (gpointer data)
TpBaseConnection *conn = (TpBaseConnection *) self;
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
+ TpHandle self_handle;
- conn->self_handle = tp_handle_ensure (contact_repo, self->priv->account,
+ self_handle = tp_handle_ensure (contact_repo, self->priv->account,
NULL, NULL);
+ tp_base_connection_set_self_handle (conn, self_handle);
- if (conn->status == TP_CONNECTION_STATUS_CONNECTING)
+ if (tp_base_connection_get_status (conn) == TP_CONNECTION_STATUS_CONNECTING)
{
tp_base_connection_change_status (conn, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_REQUESTED);
@@ -391,8 +389,8 @@ tp_tests_simple_connection_ensure_text_chan (TpTestsSimpleConnection *self,
}
else
{
- chan_path = g_strdup_printf ("%s/Channel%u", base_conn->object_path,
- count++);
+ chan_path = g_strdup_printf ("%s/Channel%u",
+ tp_base_connection_get_object_path (base_conn), count++);
chan = TP_TESTS_TEXT_CHANNEL_NULL (
tp_tests_object_new_static_class (
@@ -436,7 +434,7 @@ tp_tests_simple_connection_ensure_room_list_chan (TpTestsSimpleConnection *self,
else
{
chan_path = g_strdup_printf ("%s/RoomListChannel",
- base_conn->object_path);
+ tp_base_connection_get_object_path (base_conn));
self->priv->room_list_chan = TP_TESTS_ROOM_LIST_CHAN (
tp_tests_object_new_static_class (
@@ -485,7 +483,8 @@ get_self_handle (TpSvcConnection *iface,
return;
}
- tp_svc_connection_return_from_get_self_handle (context, base->self_handle);
+ tp_svc_connection_return_from_get_self_handle (context,
+ tp_base_connection_get_self_handle (base));
g_signal_emit (self, signals[SIGNAL_GOT_SELF_HANDLE], 0);
}
diff --git a/tests/lib/textchan-group.c b/tests/lib/textchan-group.c
index 710af4daa..8c33f53c0 100644
--- a/tests/lib/textchan-group.c
+++ b/tests/lib/textchan-group.c
@@ -83,7 +83,8 @@ add_member (GObject *obj,
tp_intset_add (add, handle);
tp_group_mixin_change_members (obj, message, add, NULL, NULL, NULL,
- self->conn->self_handle, TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
+ tp_base_connection_get_self_handle (self->conn),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
tp_intset_destroy (add);
return TRUE;
@@ -162,7 +163,8 @@ constructor (GType type,
flags |= TP_CHANNEL_GROUP_FLAG_CAN_ADD;
tp_group_mixin_init (object, G_STRUCT_OFFSET (TpTestsTextChannelGroup, group),
- contact_repo, self->conn->self_handle);
+ contact_repo,
+ tp_base_connection_get_self_handle (self->conn));
if (!self->priv->detailed)
{
@@ -344,7 +346,8 @@ tp_tests_text_channel_group_join (TpTestsTextChannelGroup *self)
TpIntset *add, *empty;
/* Add ourself as a member */
- add = tp_intset_new_containing (self->conn->self_handle);
+ add = tp_intset_new_containing (
+ tp_base_connection_get_self_handle (self->conn));
empty = tp_intset_new ();
tp_group_mixin_change_members ((GObject *) self, NULL, add, empty,
diff --git a/tests/lib/textchan-null.c b/tests/lib/textchan-null.c
index 64b156fe4..bbeb0c719 100644
--- a/tests/lib/textchan-null.c
+++ b/tests/lib/textchan-null.c
@@ -154,7 +154,8 @@ get_property (GObject *object,
g_value_set_boolean (value, TRUE);
break;
case PROP_INITIATOR_HANDLE:
- g_value_set_uint (value, self->priv->conn->self_handle);
+ g_value_set_uint (value, tp_base_connection_get_self_handle (
+ self->priv->conn));
break;
case PROP_INITIATOR_ID:
{
@@ -162,7 +163,8 @@ get_property (GObject *object,
self->priv->conn, TP_HANDLE_TYPE_CONTACT);
g_value_set_string (value,
- tp_handle_inspect (contact_repo, self->priv->conn->self_handle));
+ tp_handle_inspect (contact_repo,
+ tp_base_connection_get_self_handle (self->priv->conn)));
}
break;
case PROP_INTERFACES: