[empathy] call-factory: use TpAccountChannelRequest to request the media channel



commit b952de7a60106948665bc429ebc5129539d4ff2a
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Aug 10 16:44:48 2010 +0200

    call-factory: use TpAccountChannelRequest to request the media channel

 libempathy/empathy-call-factory.c |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/libempathy/empathy-call-factory.c b/libempathy/empathy-call-factory.c
index 06029c4..5f57f7c 100644
--- a/libempathy/empathy-call-factory.c
+++ b/libempathy/empathy-call-factory.c
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <telepathy-glib/account-channel-request.h>
 #include <telepathy-glib/simple-handler.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/util.h>
@@ -31,6 +32,9 @@
 #include "empathy-call-factory.h"
 #include "empathy-utils.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
+#include <libempathy/empathy-debug.h>
+
 G_DEFINE_TYPE(EmpathyCallFactory, empathy_call_factory, G_TYPE_OBJECT)
 
 static void handle_channels_cb (TpSimpleHandler *handler,
@@ -206,6 +210,21 @@ empathy_call_factory_create_request (EmpathyContact *contact,
       NULL);
 }
 
+static void
+create_media_channel_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 media channel: %s", error->message);
+      g_error_free (error);
+    }
+}
+
 /**
  * empathy_call_factory_new_call_with_streams:
  * @factory: an #EmpathyCallFactory
@@ -222,19 +241,21 @@ empathy_call_factory_new_call_with_streams (EmpathyContact *contact,
     gint64 timestamp,
     gpointer user_data)
 {
-  EmpathyDispatcher *dispatcher;
   GHashTable *request;
+  TpAccount *account;
+  TpAccountChannelRequest *req;
 
   request = empathy_call_factory_create_request (contact, initial_audio,
       initial_video);
 
-  dispatcher = empathy_dispatcher_dup_singleton ();
+  account = empathy_contact_get_account (contact);
+
+  req = tp_account_channel_request_new (account, request, timestamp);
 
-  empathy_dispatcher_create_channel (dispatcher,
-      empathy_contact_get_connection (contact), request, timestamp, NULL,
-      user_data);
+  tp_account_channel_request_create_channel_async (req, NULL, NULL,
+      create_media_channel_cb, NULL);
 
-  g_object_unref (dispatcher);
+  g_object_unref (req);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]