29
29
#include <telepathy-glib/interfaces.h>
30
30
#include <telepathy-glib/simple-approver.h>
32
#include <telepathy-yell/telepathy-yell.h>
32
34
#include <libempathy/empathy-idle.h>
36
#include <libempathy/empathy-channel-factory.h>
33
37
#include <libempathy/empathy-tp-contact-factory.h>
34
38
#include <libempathy/empathy-contact-manager.h>
35
39
#include <libempathy/empathy-tp-chat.h>
36
#include <libempathy/empathy-tp-call.h>
40
#include <libempathy/empathy-tp-streamed-media.h>
37
41
#include <libempathy/empathy-tp-file.h>
38
42
#include <libempathy/empathy-utils.h>
39
#include <libempathy/empathy-call-factory.h>
40
43
#include <libempathy/empathy-gsettings.h>
42
45
#include <extensions/extensions.h>
403
if (EMPATHY_IS_TP_CALL (user_data))
405
empathy_tp_call_close (user_data);
406
if (EMPATHY_IS_TP_STREAMED_MEDIA (user_data))
408
empathy_tp_streamed_media_close (user_data);
410
else if (TPY_IS_CALL_CHANNEL (user_data))
412
tpy_call_channel_hangup_async (user_data,
413
TPY_CALL_STATE_CHANGE_REASON_USER_REQUESTED,
415
tp_channel_close_async (user_data, NULL, NULL);
407
417
else if (EMPATHY_IS_TP_CHAT (user_data))
498
call = EMPATHY_TP_CALL (event->approval->handler_instance);
500
video = empathy_tp_call_has_initial_video (call);
507
if (event->public.type == EMPATHY_EVENT_TYPE_VOIP)
509
EmpathyTpStreamedMedia *call;
510
call = EMPATHY_TP_STREAMED_MEDIA (event->approval->handler_instance);
511
video = empathy_tp_streamed_media_has_initial_video (call);
513
else if (event->public.type == EMPATHY_EVENT_TYPE_CALL)
515
TpyCallChannel *call;
516
call = TPY_CALL_CHANNEL (event->approval->handler_instance);
517
g_object_get (G_OBJECT (call), "initial-video", &video, NULL);
521
g_warning ("Unknown event type: %d", event->public.type);
502
525
dialog = gtk_message_dialog_new (NULL, 0,
503
526
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
602
625
channel_type = tp_channel_get_channel_type_id (approval->main_channel);
604
if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA)
627
if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA ||
628
channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL)
607
631
if (priv->ringing == 0)
665
event_manager_call_channel_got_contact_cb (TpConnection *connection,
666
EmpathyContact *contact,
671
EventManagerApproval *approval = (EventManagerApproval *) user_data;
672
EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
674
TpyCallChannel *call;
680
DEBUG ("Can't get the contact for the call.. Rejecting?");
681
reject_approval (approval);
685
window = empathy_main_window_dup ();
686
approval->contact = g_object_ref (contact);
688
call = TPY_CALL_CHANNEL (approval->handler_instance);
690
g_object_get (G_OBJECT (call), "initial-video", &video, NULL);
692
header = g_strdup_printf (
693
video ? _("Incoming video call from %s") :_("Incoming call from %s"),
694
empathy_contact_get_alias (approval->contact));
696
event_manager_add (approval->manager, NULL,
697
approval->contact, EMPATHY_EVENT_TYPE_CALL,
698
video ? EMPATHY_IMAGE_VIDEO_CALL : EMPATHY_IMAGE_VOIP,
699
header, NULL, approval,
700
event_channel_process_voip_func, NULL);
705
if (priv->ringing == 1)
706
empathy_sound_start_playing (window,
707
EMPATHY_SOUND_PHONE_INCOMING, MS_BETWEEN_RING);
709
g_object_unref (window);
641
713
event_manager_media_channel_got_contact (EventManagerApproval *approval)
643
715
EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
644
716
GtkWidget *window = empathy_main_window_dup ();
718
EmpathyTpStreamedMedia *call;
649
call = EMPATHY_TP_CALL (approval->handler_instance);
721
call = EMPATHY_TP_STREAMED_MEDIA (approval->handler_instance);
651
video = empathy_tp_call_has_initial_video (call);
723
video = empathy_tp_streamed_media_has_initial_video (call);
653
725
header = g_strdup_printf (
654
726
video ? _("Incoming video call from %s") :_("Incoming call from %s"),
674
event_manager_media_channel_contact_changed_cb (EmpathyTpCall *call,
746
event_manager_media_channel_contact_changed_cb (EmpathyTpStreamedMedia *call,
675
747
GParamSpec *param, EventManagerApproval *approval)
677
749
EmpathyContact *contact;
871
943
channel_type = tp_channel_get_channel_type_id (channel);
873
945
if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA ||
946
channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL ||
874
947
channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER ||
875
948
channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_SERVER_AUTHENTICATION)
964
1037
else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA)
966
1039
EmpathyContact *contact;
967
EmpathyTpCall *call = empathy_tp_call_new (account, channel);
1040
EmpathyTpStreamedMedia *call = empathy_tp_streamed_media_new (account,
969
1043
approval->handler_instance = G_OBJECT (call);
1060
else if (channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL)
1062
TpyCallChannel *call = TPY_CALL_CHANNEL (channel);
1065
approval->handler_instance = g_object_ref (call);
1067
id = tp_channel_get_identifier (channel);
1069
empathy_tp_contact_factory_get_from_id (connection, id,
1070
event_manager_call_channel_got_contact_cb,
1071
approval, NULL, G_OBJECT (self));
986
1073
else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER)
988
1075
TpHandle handle;
993
1080
handle = tp_channel_get_handle (channel, NULL);
995
connection = tp_channel_borrow_connection (channel);
996
1082
empathy_tp_contact_factory_get_from_handle (connection, handle,
997
1083
event_manager_ft_got_contact_cb, approval, NULL, G_OBJECT (self));
1057
header = g_strdup_printf (_("%s would like permission to see when you are available"),
1058
empathy_contact_get_alias (contact));
1143
header = g_strdup_printf (
1144
_("%s would like permission to see when you are online"),
1145
empathy_contact_get_alias (contact));
1060
1147
if (!EMP_STR_EMPTY (message))
1061
1148
event_msg = g_strdup_printf (_("\nMessage: %s"), message);
1260
1348
priv->approver = tp_simple_approver_new (dbus, "Empathy.EventManager", FALSE,
1261
1349
approve_channels, manager, NULL);
1351
factory = empathy_channel_factory_new ();
1352
tp_base_client_set_channel_factory (priv->approver,
1353
TP_CLIENT_CHANNEL_FACTORY (factory));
1354
g_object_unref (factory);
1263
1356
/* Private text channels */
1264
1357
tp_base_client_take_approver_filter (priv->approver,
1289
1382
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
1290
1383
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
1385
tp_base_client_take_approver_filter (priv->approver,
1387
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
1388
TPY_IFACE_CHANNEL_TYPE_CALL,
1389
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
1293
1392
/* I don't feel good about doing this, and I'm sorry, but the
1294
1393
* capabilities connection feature is added earlier because it's