diff options
-rw-r--r-- | src/empathy-call-factory.c | 52 | ||||
-rw-r--r-- | src/empathy-call-factory.h | 6 | ||||
-rw-r--r-- | src/empathy-call-handler.c | 63 |
3 files changed, 35 insertions, 86 deletions
diff --git a/src/empathy-call-factory.c b/src/empathy-call-factory.c index 5d14ad52d..cced7648f 100644 --- a/src/empathy-call-factory.c +++ b/src/empathy-call-factory.c @@ -34,8 +34,6 @@ #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-utils.h> -#include <libempathy-gtk/empathy-call-utils.h> - #include "empathy-call-factory.h" #include "empathy-call-handler.h" #include "src-marshal.h" @@ -210,56 +208,6 @@ empathy_call_factory_get (void) } static void -create_call_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 call channel: %s", error->message); - g_error_free (error); - } -} - -/** - * empathy_call_factory_new_call_with_streams: - * @factory: an #EmpathyCallFactory - * @contact: an #EmpathyContact - * @initial_audio: if %TRUE the call will be started with audio - * @initial_video: if %TRUE the call will be started with video - * - * Initiate a new Call with @contact. - */ -void -empathy_call_factory_new_call_with_streams (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video, - gint64 timestamp, - gpointer user_data) -{ - GHashTable *call_request; - TpAccount *account; - TpAccountChannelRequest *call_req; - - call_request = empathy_call_create_call_request ( - empathy_contact_get_id (contact), - initial_audio, initial_video); - - account = empathy_contact_get_account (contact); - - call_req = tp_account_channel_request_new (account, call_request, timestamp); - - tp_account_channel_request_create_channel_async (call_req, NULL, NULL, - create_call_channel_cb, NULL); - - g_hash_table_unref (call_request); - g_object_unref (call_req); -} - -static void call_channel_got_contact (TpConnection *connection, EmpathyContact *contact, const GError *error, diff --git a/src/empathy-call-factory.h b/src/empathy-call-factory.h index d739b4802..4db2e35fd 100644 --- a/src/empathy-call-factory.h +++ b/src/empathy-call-factory.h @@ -63,12 +63,6 @@ EmpathyCallFactory *empathy_call_factory_initialise (void); EmpathyCallFactory *empathy_call_factory_get (void); -void empathy_call_factory_new_call_with_streams (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video, - gint64 timestamp, - gpointer user_data); - gboolean empathy_call_factory_register (EmpathyCallFactory *self, GError **error); diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c index 56d109838..82fd68c1b 100644 --- a/src/empathy-call-handler.c +++ b/src/empathy-call-handler.c @@ -30,11 +30,13 @@ #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 @@ -179,7 +181,8 @@ on_call_invalidated_cb (TpyCallChannel *call, if (priv->call == call) { /* Invalidated unexpectedly? Fake call ending */ - g_signal_emit (self, signals[STATE_CHANGED], 0, TPY_CALL_STATE_ENDED); + g_signal_emit (self, signals[STATE_CHANGED], 0, + TPY_CALL_STATE_ENDED, NULL); tp_clear_object (&priv->call); tp_clear_object (&priv->tfchannel); } @@ -888,7 +891,21 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self) on_tf_channel_ready, self); } -#if 0 +static void +on_call_accepted_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + TpyCallChannel *call = TPY_CALL_CHANNEL (source_object); + GError *error = NULL; + + if (!tpy_call_channel_accept_finish (call, res, &error)) + { + g_warning ("could not accept Call: %s", error->message); + g_error_free (error); + } +} + static void empathy_call_handler_request_cb (GObject *source, GAsyncResult *result, @@ -916,26 +933,15 @@ 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); -} -#endif - -static void -on_call_accepted_cb (GObject *source_object, - GAsyncResult *res, - gpointer user_data) -{ - TpyCallChannel *call = TPY_CALL_CHANNEL (source_object); - GError *error = NULL; - - if (!tpy_call_channel_accept_finish (call, res, &error)) - { - g_warning ("could not accept Call: %s", error->message); - g_error_free (error); - } + tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); } void @@ -943,9 +949,10 @@ 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) { @@ -953,27 +960,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 } /** |