summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2011-02-01 22:00:46 +0200
committerPekka Pessi <Pekka.Pessi@nokia.com>2011-02-01 22:00:46 +0200
commit12f13047d596201c53d87be8e812fa554645744b (patch)
tree51f723f0608bcb59cced6418f3151df8fbff3b5c
parent5fd450b66d3be87f96ec19988172d5dd0206dfbd (diff)
ring-media-channel: accept hold requests while hold is pending
-rw-r--r--src/ring-media-channel.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/ring-media-channel.c b/src/ring-media-channel.c
index ce0b5ab..35aad36 100644
--- a/src/ring-media-channel.c
+++ b/src/ring-media-channel.c
@@ -814,22 +814,30 @@ void request_hold (TpSvcChannelInterfaceHold *iface,
ModemCall *instance = self->call_instance;
GError *error = NULL;
+ uint8_t state, next;
ModemCallState expect;
DEBUG ("(%u) on %s", hold, self->nick);
- hold = hold != 0;
if (hold)
- expect = MODEM_CALL_STATE_ACTIVE;
+ {
+ expect = MODEM_CALL_STATE_ACTIVE;
+ state = TP_LOCAL_HOLD_STATE_HELD;
+ next = TP_LOCAL_HOLD_STATE_PENDING_HOLD;
+ }
else
- expect = MODEM_CALL_STATE_HELD;
+ {
+ expect = MODEM_CALL_STATE_HELD;
+ state = TP_LOCAL_HOLD_STATE_UNHELD;
+ next = TP_LOCAL_HOLD_STATE_PENDING_UNHOLD;
+ }
if (instance == NULL)
{
g_set_error(&error, TP_ERRORS, TP_ERROR_DISCONNECTED,
"Channel is not connected");
}
- else if (hold == priv->hold.state)
+ else if (state == priv->hold.state || next == priv->hold.state)
{
priv->hold.reason = TP_LOCAL_HOLD_STATE_REASON_REQUESTED;
tp_svc_channel_interface_hold_return_from_request_hold(context);
@@ -852,14 +860,13 @@ void request_hold (TpSvcChannelInterfaceHold *iface,
g_object_ref (self);
- priv->control = modem_call_request_hold (instance, hold, response_to_hold, self);
+ priv->control = modem_call_request_hold (instance, hold,
+ response_to_hold, self);
ring_media_channel_queue_request (self, priv->control);
- priv->hold.requested = hold;
+ priv->hold.requested = state;
- ring_update_hold (self,
- hold ? TP_LOCAL_HOLD_STATE_PENDING_HOLD : TP_LOCAL_HOLD_STATE_PENDING_UNHOLD,
- TP_LOCAL_HOLD_STATE_REASON_REQUESTED);
+ ring_update_hold (self, next, TP_LOCAL_HOLD_STATE_REASON_REQUESTED);
return;
}