]> git.0d.be Git - empathy.git/commitdiff
Implement empathy_call_handler_start_call() for redialing
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Mon, 16 May 2011 15:43:59 +0000 (16:43 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 9 Jun 2011 09:20:08 +0000 (10:20 +0100)
src/empathy-call-handler.c

index cf9c1b03ed66b04a9ee588ccbb7804b92cbdc122..18d0d1f9e3e1c8b569f03c8bfcd230ed8400ea63 100644 (file)
 
 #include <telepathy-farstream/telepathy-farstream.h>
 
+#include <libempathy/empathy-channel-factory.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-tp-contact-factory.h>
 
+#include <libempathy-gtk/empathy-call-utils.h>
+
 #include "empathy-call-handler.h"
-#include "empathy-call-factory.h"
 #include "src-marshal.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_VOIP
@@ -899,7 +901,6 @@ on_call_accepted_cb (GObject *source_object,
     }
 }
 
-#if 0
 static void
 empathy_call_handler_request_cb (GObject *source,
     GAsyncResult *result,
@@ -927,21 +928,26 @@ empathy_call_handler_request_cb (GObject *source,
     }
 
   priv->call = TPY_CALL_CHANNEL (channel);
+  tp_g_signal_connect_object (priv->call, "state-changed",
+    G_CALLBACK (on_call_state_changed_cb), self, 0);
+  tp_g_signal_connect_object (priv->call, "invalidated",
+    G_CALLBACK (on_call_invalidated_cb), self, 0);
 
   g_object_notify (G_OBJECT (self), "call-channel");
 
   empathy_call_handler_start_tpfs (self);
+  tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL);
 }
-#endif
 
 void
 empathy_call_handler_start_call (EmpathyCallHandler *handler,
     gint64 timestamp)
 {
   EmpathyCallHandlerPriv *priv = GET_PRIV (handler);
-/*TpAccountChannelRequest *req;
+  EmpathyChannelFactory *channel_factory;
+  TpAccountChannelRequest *req;
   TpAccount *account;
-  GHashTable *request;*/
+  GHashTable *request;
 
   if (priv->call != NULL)
     {
@@ -949,27 +955,27 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler,
       tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL);
       return;
     }
-  else
-    {
-      g_warning ("No Call channel!");
-    }
 
-#if 0
   /* No TpyCallChannel (we are redialing). Request a new call channel */
   g_assert (priv->contact != NULL);
 
   account = empathy_contact_get_account (priv->contact);
-  request = empathy_call_create_call_request (priv->contact,
+  request = empathy_call_create_call_request (
+      empathy_contact_get_id (priv->contact),
       priv->initial_audio, priv->initial_video);
 
   req = tp_account_channel_request_new (account, request, timestamp);
 
+  channel_factory = empathy_channel_factory_dup ();
+  tp_account_channel_request_set_channel_factory (req,
+      TP_CLIENT_CHANNEL_FACTORY (channel_factory));
+  g_object_unref (channel_factory);
+
   tp_account_channel_request_create_and_handle_channel_async (req, NULL,
       empathy_call_handler_request_cb, handler);
 
   g_object_unref (req);
   g_hash_table_unref (request);
-#endif
 }
 
 /**