summaryrefslogtreecommitdiff
path: root/examples/cm/contactlist/conn.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cm/contactlist/conn.c')
-rw-r--r--examples/cm/contactlist/conn.c19
1 files changed, 10 insertions, 9 deletions
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);