aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-14 21:23:19 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-14 21:28:54 +0800
commit07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e (patch)
tree11b6bae98f31b6174ab481264650b04dfd5b4eca
parent84e01611475d67c21b718a35ed5f1b2587b64544 (diff)
downloadgsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.tar
gsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.tar.gz
gsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.tar.bz2
gsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.tar.lz
gsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.tar.xz
gsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.tar.zst
gsoc2013-empathy-07ecd3f4d9cc71d4192599a89a9c8f45f7958c3e.zip
Reject approval if call was hung up during approval
If an incoming call gets ENDED during our approval stage either we or someone else closed it. In that case reject the approval (which will claim and close the channel). A future improvement could be to show a notification in case this happens
-rw-r--r--src/empathy-event-manager.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 5b4434522..61ebcf56a 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -662,6 +662,21 @@ cdo_invalidated_cb (TpProxy *cdo,
}
static void
+event_manager_call_state_changed_cb (TpyCallChannel *call,
+ TpyCallState state,
+ TpyCallFlags flags,
+ const GValueArray *call_state_reason,
+ GHashTable *call_state_details,
+ EventManagerApproval *approval)
+{
+ if (state == TPY_CALL_STATE_ENDED)
+ {
+ DEBUG ("Call ended, seems we missed it :/");
+ reject_approval (approval);
+ }
+}
+
+static void
event_manager_call_channel_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
@@ -675,6 +690,8 @@ event_manager_call_channel_got_contact_cb (TpConnection *connection,
gchar *header;
gboolean video;
+ call = TPY_CALL_CHANNEL (approval->handler_instance);
+
if (error != NULL)
{
DEBUG ("Can't get the contact for the call.. Rejecting?");
@@ -682,11 +699,19 @@ event_manager_call_channel_got_contact_cb (TpConnection *connection,
return;
}
+ if (tpy_call_channel_get_state (call, NULL, NULL) == TPY_CALL_STATE_ENDED)
+ {
+ DEBUG ("Call already ended, seems we missed it :/");
+ reject_approval (approval);
+ return;
+ }
+
+ approval->handler = g_signal_connect (call, "state-changed",
+ G_CALLBACK (event_manager_call_state_changed_cb), approval);
+
window = empathy_main_window_dup ();
approval->contact = g_object_ref (contact);
- call = TPY_CALL_CHANNEL (approval->handler_instance);
-
g_object_get (G_OBJECT (call), "initial-video", &video, NULL);
header = g_strdup_printf (