diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-02-16 07:29:05 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-04-22 18:17:01 +0800 |
commit | c610a3c60a11f0130989392ad9b13840208eafe9 (patch) | |
tree | 7ae2f0efb4c74877eab8f6273e6ff4cb0990b0bd /libempathy | |
parent | 0dc53f30dabfec9b7c60ea5c107a05af4837b6ca (diff) | |
download | gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.tar gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.tar.gz gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.tar.bz2 gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.tar.lz gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.tar.xz gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.tar.zst gsoc2013-empathy-c610a3c60a11f0130989392ad9b13840208eafe9.zip |
Port EmpathyCallHandler to new API
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-call-handler.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c index 39d5899bd..820de6de5 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-call-handler.c @@ -402,30 +402,38 @@ empathy_call_handler_request_cb (EmpathyDispatchOperation *operation, empathy_dispatch_operation_claim (operation); } -static void -empathy_call_handler_contact_ready_cb (EmpathyContact *contact, - const GError *error, gpointer user_data, GObject *object) +void +empathy_call_handler_start_call (EmpathyCallHandler *handler) { - EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (object); - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + + EmpathyCallHandlerPriv *priv = GET_PRIV (handler); EmpathyDispatcher *dispatcher; - McAccount *account; + TpConnection *connection; GStrv allowed; GValue *value; - GHashTable *request = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, - (GDestroyNotify) tp_g_value_slice_free); + GHashTable *request; + + if (priv->call != NULL) + { + empathy_call_handler_start_tpfs (handler); + empathy_tp_call_accept_incoming_call (priv->call); + return; + } g_assert (priv->contact != NULL); dispatcher = empathy_dispatcher_dup_singleton (); - account = empathy_contact_get_account (priv->contact); - allowed = empathy_dispatcher_find_channel_class (dispatcher, account, + connection = empathy_contact_get_connection (priv->contact); + allowed = empathy_dispatcher_find_channel_class (dispatcher, connection, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_HANDLE_TYPE_CONTACT); if (!tp_strv_contains ((const gchar * const *) allowed, TP_IFACE_CHANNEL ".TargetHandle")) return; + request = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, + (GDestroyNotify) tp_g_value_slice_free); + /* org.freedesktop.Telepathy.Channel.ChannelType */ value = tp_g_value_slice_new (G_TYPE_STRING); g_value_set_string (value, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA); @@ -441,27 +449,9 @@ empathy_call_handler_contact_ready_cb (EmpathyContact *contact, g_value_set_uint (value, empathy_contact_get_handle (priv->contact)); g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandle", value); - empathy_dispatcher_create_channel (dispatcher, account, - request, empathy_call_handler_request_cb, self); + empathy_dispatcher_create_channel (dispatcher, connection, + request, empathy_call_handler_request_cb, handler); g_object_unref (dispatcher); } -void -empathy_call_handler_start_call (EmpathyCallHandler *handler) -{ - - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); - - if (priv->call == NULL) - { - empathy_contact_call_when_ready (priv->contact, - EMPATHY_CONTACT_READY_HANDLE, - empathy_call_handler_contact_ready_cb, NULL, NULL, G_OBJECT (handler)); - } - else - { - empathy_call_handler_start_tpfs (handler); - empathy_tp_call_accept_incoming_call (priv->call); - } -} |