[empathy] tp-chat: use TpAccountChannelRequest
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] tp-chat: use TpAccountChannelRequest
- Date: Wed, 11 Aug 2010 11:34:05 +0000 (UTC)
commit 45e0ed0dd99ba9909721ef0838306764c9156655
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Aug 10 17:19:12 2010 +0200
tp-chat: use TpAccountChannelRequest
libempathy/empathy-tp-chat.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 0ec8666..9a4e56a 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -111,6 +111,20 @@ tp_chat_async_cb (TpChannel *proxy,
}
static void
+create_conference_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ if (!tp_account_channel_request_create_channel_finish (
+ TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) {
+ DEBUG ("Failed to create conference channel: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
tp_chat_add (EmpathyContactList *list,
EmpathyContact *contact,
const gchar *message)
@@ -129,14 +143,12 @@ tp_chat_add (EmpathyContactList *list,
tp_cli_channel_interface_group_call_add_members (priv->channel,
-1, &handles, NULL, NULL, NULL, NULL, NULL);
} else if (priv->can_upgrade_to_muc) {
- EmpathyDispatcher *dispatcher;
+ TpAccountChannelRequest *req;
GHashTable *props;
const char *object_path;
GPtrArray channels = { (gpointer *) &object_path, 1 };
const char *invitees[2] = { NULL, };
- dispatcher = empathy_dispatcher_dup_singleton ();
-
invitees[0] = empathy_contact_get_id (contact);
object_path = tp_proxy_get_object_path (priv->channel);
@@ -152,13 +164,17 @@ tp_chat_add (EmpathyContactList *list,
/* FIXME: InvitationMessage ? */
NULL);
+ req = tp_account_channel_request_new (
+ empathy_get_account_for_connection (priv->connection), props,
+ EMPATHY_DISPATCHER_NON_USER_ACTION);
+
/* Although this is a MUC, it's anonymous, so CreateChannel is
- * valid.
- * props now belongs to EmpathyDispatcher, don't free it */
- empathy_dispatcher_create_channel (dispatcher, priv->connection,
- props, EMPATHY_DISPATCHER_NON_USER_ACTION, NULL, NULL);
+ * valid. */
+ tp_account_channel_request_create_channel_async (req, NULL, NULL,
+ create_conference_cb, NULL);
- g_object_unref (dispatcher);
+ g_object_unref (req);
+ g_hash_table_unref (props);
} else {
g_warning ("Cannot add to this channel");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]