From e299c45fb57f72df0a6116b0158b328f93b73c73 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 16 Sep 2013 19:28:19 +0100 Subject: [PATCH 1/4] Finish "sealing" TpBaseConnection Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69272 --- src/connection-aliasing.c | 7 ++++--- src/connection-avatars.c | 11 ++++++----- src/connection-presence.c | 4 ++-- src/contact-list.c | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/connection-aliasing.c b/src/connection-aliasing.c index f9b51c2..397eab0 100644 --- a/src/connection-aliasing.c +++ b/src/connection-aliasing.c @@ -67,7 +67,7 @@ get_alias (HazeConnection *self, const gchar *bname = tp_handle_inspect (contact_handles, handle); const gchar *alias; - if (handle == base->self_handle) + if (handle == tp_base_connection_get_self_handle (base)) { alias = purple_connection_get_display_name (self->account->gc); @@ -189,7 +189,7 @@ set_alias_success_cb (PurpleAccount *account, dbus_g_type_specialized_construct (TP_STRUCT_TYPE_ALIAS_PAIR)); dbus_g_type_struct_set (&entry, - 0, base_conn->self_handle, + 0, tp_base_connection_get_self_handle (base_conn), 1, new_alias, G_MAXUINT); @@ -227,7 +227,8 @@ set_aliases_foreach (gpointer key, { /* stop already */ } - else if (handle == TP_BASE_CONNECTION (data->conn)->self_handle) + else if (handle == tp_base_connection_get_self_handle ( + TP_BASE_CONNECTION (data->conn))) { DEBUG ("setting alias for myself to \"%s\"", new_alias); purple_account_set_public_alias (data->conn->account, diff --git a/src/connection-avatars.c b/src/connection-avatars.c index 42fd24d..2f9b133 100644 --- a/src/connection-avatars.c +++ b/src/connection-avatars.c @@ -95,7 +95,7 @@ haze_connection_avatars_properties_getter (GObject *object, PurplePluginProtocolInfo *prpl_info; PurpleBuddyIconSpec *icon_spec; - if (base->status != TP_CONNECTION_STATUS_CONNECTED) + if (tp_base_connection_get_status (base) != TP_CONNECTION_STATUS_CONNECTED) { /* not CONNECTED yet, so our connection doesn't have the prpl info * yet - return dummy values */ @@ -185,7 +185,8 @@ get_avatar (HazeConnection *conn, tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); gconstpointer icon_data = NULL; size_t icon_size = 0; - if (handle == base->self_handle) + + if (handle == tp_base_connection_get_self_handle (base)) { PurpleStoredImage *image = purple_buddy_icons_find_account_icon (conn->account); @@ -329,7 +330,7 @@ haze_connection_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars *self, * avatar you last used. So we special-case self_handle here. */ - if (handle == base_conn->self_handle) + if (handle == tp_base_connection_get_self_handle (base_conn)) { GArray *avatar = get_avatar (conn, handle); if (avatar != NULL) @@ -426,7 +427,7 @@ haze_connection_clear_avatar (TpSvcConnectionInterfaceAvatars *self, tp_svc_connection_interface_avatars_return_from_clear_avatar (context); tp_svc_connection_interface_avatars_emit_avatar_updated (conn, - base_conn->self_handle, ""); + tp_base_connection_get_self_handle (base_conn), ""); } static void @@ -504,7 +505,7 @@ haze_connection_set_avatar (TpSvcConnectionInterfaceAvatars *self, tp_svc_connection_interface_avatars_return_from_set_avatar (context, token); tp_svc_connection_interface_avatars_emit_avatar_updated (conn, - base_conn->self_handle, token); + tp_base_connection_get_self_handle (base_conn), token); g_free (token); } diff --git a/src/connection-presence.c b/src/connection-presence.c index 1455a65..050500b 100644 --- a/src/connection-presence.c +++ b/src/connection-presence.c @@ -166,7 +166,7 @@ _get_contact_statuses (GObject *obj, g_assert (tp_handle_is_valid (handle_repo, handle, NULL)); - if (handle == base_conn->self_handle) + if (handle == tp_base_connection_get_self_handle (base_conn)) { p_status = purple_account_get_active_status (conn->account); } @@ -217,7 +217,7 @@ haze_connection_presence_account_status_changed (PurpleAccount *account, tp_status = _get_tp_status (status); tp_presence_mixin_emit_one_presence_update (G_OBJECT (base_conn), - base_conn->self_handle, tp_status); + tp_base_connection_get_self_handle (base_conn), tp_status); } } diff --git a/src/contact-list.c b/src/contact-list.c index 9a2fba9..5954287 100644 --- a/src/contact-list.c +++ b/src/contact-list.c @@ -322,7 +322,8 @@ buddy_removed_cb (PurpleBuddy *buddy, gpointer unused) /* Every buddy gets removed after disconnection, because the PurpleAccount * gets deleted. So let's ignore removals when we're offline. */ - if (base_conn->status == TP_CONNECTION_STATUS_DISCONNECTED) + if (tp_base_connection_get_status (base_conn) == + TP_CONNECTION_STATUS_DISCONNECTED) return; contact_list = conn->contact_list; -- 1.8.4.rc3