From b952de7a60106948665bc429ebc5129539d4ff2a Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 10 Aug 2010 16:44:48 +0200 Subject: call-factory: use TpAccountChannelRequest to request the media channel --- libempathy/empathy-call-factory.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/libempathy/empathy-call-factory.c b/libempathy/empathy-call-factory.c index 06029c4bd..5f57f7c24 100644 --- a/libempathy/empathy-call-factory.c +++ b/libempathy/empathy-call-factory.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -31,6 +32,9 @@ #include "empathy-call-factory.h" #include "empathy-utils.h" +#define DEBUG_FLAG EMPATHY_DEBUG_VOIP +#include + 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 -- cgit v1.2.3