From 6fb143b09acd744811883c4f1177a843ec60daaf Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 9 Jan 2009 16:12:40 +0000 Subject: Enable approving of file transfers Signed-off-by: Sjoerd Simons svn path=/trunk/; revision=2138 --- src/empathy-event-manager.c | 72 +++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 72417328b..d88d0b0cd 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -239,25 +239,25 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher, channel_type = empathy_dispatch_operation_get_channel_type (operation); + approval = event_manager_approval_new (manager, operation); + priv->approvals = g_slist_prepend (priv->approvals, approval); + + approval->approved_handler = g_signal_connect (operation, "approved", + G_CALLBACK (event_manager_operation_approved_cb), approval); + + approval->claimed_handler = g_signal_connect (operation, "claimed", + G_CALLBACK (event_manager_operation_claimed_cb), approval); + if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT)) { EmpathyTpChat *tp_chat = EMPATHY_TP_CHAT ( empathy_dispatch_operation_get_channel_wrapper (operation)); - approval = event_manager_approval_new (manager, operation); - priv->approvals = g_slist_prepend (priv->approvals, approval); - g_signal_connect (tp_chat, "message-received", G_CALLBACK (event_manager_chat_message_received_cb), approval); g_object_unref (G_OBJECT (tp_chat)); - approval->approved_handler = g_signal_connect (operation, "approved", - G_CALLBACK (event_manager_operation_approved_cb), approval); - - approval->claimed_handler = g_signal_connect (operation, "claimed", - G_CALLBACK (event_manager_operation_claimed_cb), approval); - } #if 0 else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA)) { @@ -282,38 +282,40 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher, g_object_unref (contact); g_object_unref (tp_group); } - else if (!tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER)) { - EmpathyContact *contact; - gchar *msg; - TpHandle handle; - McAccount *account; - EmpathyContactFactory *factory; - - factory = empathy_contact_factory_dup_singleton (); - handle = tp_channel_get_handle (channel, NULL); - account = empathy_channel_get_account (channel); +#endif + else if (!tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER)) + { + EmpathyContact *contact; + gchar *msg; + TpHandle handle; + McAccount *account; + EmpathyContactFactory *factory; + TpChannel *channel = empathy_dispatch_operation_get_channel (operation); - contact = empathy_contact_factory_get_from_handle (factory, - account, - handle); + factory = empathy_contact_factory_dup_singleton (); + handle = tp_channel_get_handle (channel, NULL); + account = empathy_channel_get_account (channel); - empathy_contact_run_until_ready (contact, - EMPATHY_CONTACT_READY_NAME, NULL); + contact = empathy_contact_factory_get_from_handle (factory, account, + handle); - msg = g_strdup_printf (_("Incoming file transfer from %s"), - empathy_contact_get_name (contact)); + empathy_contact_run_until_ready (contact, + EMPATHY_CONTACT_READY_NAME, NULL); - event_manager_add (manager, contact, - EMPATHY_IMAGE_DOCUMENT_SEND, - msg, channel, - event_channel_process_func, NULL); + msg = g_strdup_printf (_("Incoming file transfer from %s"), + empathy_contact_get_name (contact)); - g_object_unref (factory); - g_object_unref (account); - } + event_manager_add (manager, contact, EMPATHY_IMAGE_DOCUMENT_SEND, + msg, approval, event_channel_process_func, NULL); - g_free (channel_type); -#endif + g_object_unref (channel); + g_object_unref (factory); + g_object_unref (account); + } + else + { + DEBUG ("Unknown channel type, ignoring.."); + } } #if 0 /* FIXME dispatcher */ -- cgit v1.2.3