aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-02 17:42:59 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-03 16:53:34 +0800
commit9173fd2111ceb3ed736515396398c64aa64deee9 (patch)
tree2667155afe9fee3e2bada0ba5b8f2aad0fca4ca0 /libempathy
parent73b1e75262d87d78602b6c8cc6c9bec8aa875f0b (diff)
downloadgsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.tar
gsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.tar.gz
gsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.tar.bz2
gsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.tar.lz
gsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.tar.xz
gsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.tar.zst
gsoc2013-empathy-9173fd2111ceb3ed736515396398c64aa64deee9.zip
tp_chat_prepare_ready_async: use new channel group API
https://bugzilla.gnome.org/show_bug.cgi?id=675229
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-chat.c62
1 files changed, 16 insertions, 46 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index f66fe2d7c..e48984017 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1061,46 +1061,22 @@ tp_chat_group_members_changed_cb (TpChannel *channel,
}
static void
-tp_chat_got_remote_contact_cb (TpConnection *connection,
- EmpathyContact *contact,
- const GError *error,
- gpointer user_data,
- GObject *chat)
+create_remote_contact (EmpathyTpChat *self,
+ TpContact *contact)
{
- EmpathyTpChat *self = (EmpathyTpChat *) chat;
-
- if (error != NULL)
- {
- DEBUG ("Error: %s", error->message);
- empathy_tp_chat_leave (self, "");
- return;
- }
-
- self->priv->remote_contact = g_object_ref (contact);
- g_object_notify (chat, "remote-contact");
+ self->priv->remote_contact = empathy_contact_dup_from_tp_contact (contact);
+ g_object_notify (G_OBJECT (self), "remote-contact");
check_almost_ready (self);
}
static void
-tp_chat_got_self_contact_cb (TpConnection *connection,
- EmpathyContact *contact,
- const GError *error,
- gpointer user_data,
- GObject *chat)
+create_self_contact (EmpathyTpChat *self,
+ TpContact *contact)
{
- EmpathyTpChat *self = (EmpathyTpChat *) chat;
-
- if (error != NULL)
- {
- DEBUG ("Error: %s", error->message);
- empathy_tp_chat_leave (self, "");
- return;
- }
-
- self->priv->user = g_object_ref (contact);
+ self->priv->user = empathy_contact_dup_from_tp_contact (contact);
empathy_contact_set_is_user (self->priv->user, TRUE);
- g_object_notify (chat, "self-contact");
+ g_object_notify (G_OBJECT (self), "self-contact");
check_almost_ready (self);
}
@@ -1526,13 +1502,11 @@ tp_chat_prepare_ready_async (TpProxy *proxy,
{
const TpIntSet *members;
GArray *handles;
- TpHandle handle;
+ TpContact *contact;
/* Get self contact from the group's self handle */
- handle = tp_channel_group_get_self_handle (channel);
- empathy_tp_contact_factory_get_from_handle (connection,
- handle, tp_chat_got_self_contact_cb,
- NULL, NULL, G_OBJECT (self));
+ contact = tp_channel_group_get_self_contact (channel);
+ create_self_contact (self, contact);
/* Get initial member contacts */
members = tp_channel_group_get_members (channel);
@@ -1551,19 +1525,15 @@ tp_chat_prepare_ready_async (TpProxy *proxy,
TpCapabilities *caps;
GPtrArray *classes;
guint i;
- TpHandle handle;
+ TpContact *contact;
/* Get the self contact from the connection's self handle */
- handle = tp_connection_get_self_handle (connection);
- empathy_tp_contact_factory_get_from_handle (connection,
- handle, tp_chat_got_self_contact_cb,
- NULL, NULL, G_OBJECT (self));
+ contact = tp_connection_get_self_contact (connection);
+ create_self_contact (self, contact);
/* Get the remote contact */
- handle = tp_channel_get_handle (channel, NULL);
- empathy_tp_contact_factory_get_from_handle (connection,
- handle, tp_chat_got_remote_contact_cb,
- NULL, NULL, G_OBJECT (self));
+ contact = tp_channel_get_target_contact (channel);
+ create_remote_contact (self, contact);
caps = tp_connection_get_capabilities (connection);
g_assert (caps != NULL);