aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-03-18 08:28:03 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-04-22 18:21:14 +0800
commit7761eeb4a0e307c14a96906cca1a94346f39c3a6 (patch)
treea0cf285000890c0633bdc1031bddcb73f9b952d5 /libempathy
parent2914c6d76ae6a76e551ccaad01bc9edf2f375d08 (diff)
downloadgsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.tar
gsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.tar.gz
gsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.tar.bz2
gsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.tar.lz
gsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.tar.xz
gsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.tar.zst
gsoc2013-empathy-7761eeb4a0e307c14a96906cca1a94346f39c3a6.zip
Use tp_connection_get_self_handle where needed
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c14
-rw-r--r--libempathy/empathy-tp-chat.c27
-rw-r--r--libempathy/empathy-tp-contact-factory.c9
3 files changed, 12 insertions, 38 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 379109285..51259bddf 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -727,20 +727,6 @@ empathy_contact_is_user (EmpathyContact *contact)
priv = GET_PRIV (contact);
- /* FIXME: Uncomment this once we depend on tp-glib 0.7.26
- if (priv->tp_contact != NULL)
- {
- TpConnection *connection;
- TpHandle handle;
- TpHandle self_handle;
-
- connection = tp_contact_get_connection (priv->tp_contact);
- self_handle = tp_connection_get_self_handle (connection);
- handle = tp_contact_get_handle (priv->tp_contact);
- return self_handle == handle;
- }
- */
-
return priv->is_user;
}
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index bc99ba513..ec28e2625 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -962,27 +962,6 @@ tp_chat_got_self_contact_cb (EmpathyTpContactFactory *factory,
tp_chat_check_if_ready (EMPATHY_TP_CHAT (chat));
}
-static void
-tp_chat_get_self_handle_cb (TpConnection *connection,
- TpHandle self_handle,
- const GError *error,
- gpointer user_data,
- GObject *chat)
-{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
-
- if (error) {
- DEBUG ("Error: %s", error->message);
- tp_cli_channel_call_close (priv->channel, -1,
- NULL, NULL, NULL, NULL);
- return;
- }
-
- empathy_tp_contact_factory_get_from_handle (priv->factory,
- self_handle, tp_chat_got_self_contact_cb,
- NULL, NULL, chat);
-}
-
static GObject *
tp_chat_constructor (GType type,
guint n_props,
@@ -1025,8 +1004,10 @@ tp_chat_constructor (GType type,
G_CALLBACK (tp_chat_group_members_changed_cb), chat);
} else {
/* Get the self contact from the connection's self handle */
- tp_cli_connection_call_get_self_handle (connection, -1,
- tp_chat_get_self_handle_cb, NULL, NULL, chat);
+ handle = tp_connection_get_self_handle (connection);
+ empathy_tp_contact_factory_get_from_handle (priv->factory,
+ handle, tp_chat_got_self_contact_cb,
+ NULL, NULL, chat);
/* Get the remote contact */
handle = tp_channel_get_handle (priv->channel, NULL);
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index b96af76b8..7735b0f1a 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -502,6 +502,7 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory,
EmpathyContact *contact)
{
EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
+ TpHandle self_handle;
TpHandle handle;
GArray handles = {(gchar*) &handle, 1};
GHashTable *tokens;
@@ -529,8 +530,14 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory,
empathy_contact_set_capabilities (contact, caps);
}
- /* FIXME: This should be done by TpContact */
+ /* Set is-user property. Note that it could still be the handle is
+ * different from the connection's self handle, in the case the handle
+ * comes from a group interface. */
+ self_handle = tp_connection_get_self_handle (priv->connection);
handle = empathy_contact_get_handle (contact);
+ empathy_contact_set_is_user (contact, self_handle == handle);
+
+ /* FIXME: This should be done by TpContact */
tp_cli_connection_interface_avatars_run_get_known_avatar_tokens (priv->connection,
-1,
&handles,