diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-12-09 15:33:51 +0100 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-01-10 09:52:45 +0100 |
commit | 204f700e0d45d6dce65f12ef4c84d3de3f50a35e (patch) | |
tree | 6b9f09dfd2befffdbd3b9b26d9ba8f6230f897b6 /telepathy-glib/base-call-channel.c | |
parent | b68d0a041345e8967f55b75e039a985c298cfb3f (diff) | |
download | telepathy-glib-204f700e0d45d6dce65f12ef4c84d3de3f50a35e.tar.gz |
Fix Initialising->Initialised transition
Diffstat (limited to 'telepathy-glib/base-call-channel.c')
-rw-r--r-- | telepathy-glib/base-call-channel.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/telepathy-glib/base-call-channel.c b/telepathy-glib/base-call-channel.c index 923e52ad8..d3824f9c7 100644 --- a/telepathy-glib/base-call-channel.c +++ b/telepathy-glib/base-call-channel.c @@ -700,8 +700,12 @@ tp_base_call_channel_set_state (TpBaseCallChannel *self, const gchar *dbus_reason, const gchar *message) { + TpCallState old_state; + g_return_if_fail (TP_IS_BASE_CALL_CHANNEL (self)); + old_state = self->priv->state; + self->priv->state = state; g_value_array_free (self->priv->reason); self->priv->reason = _tp_base_call_state_reason_new (actor_handle, reason, @@ -717,6 +721,11 @@ tp_base_call_channel_set_state (TpBaseCallChannel *self, if (tp_base_channel_is_registered (TP_BASE_CHANNEL (self))) tp_svc_channel_type_call_emit_call_state_changed (self, self->priv->state, self->priv->flags, self->priv->reason, self->priv->details); + + /* If we moved to INITIALISING, maybe we are actually already INITIALISED */ + if (self->priv->state != old_state && + self->priv->state == TP_CALL_STATE_INITIALISING) + _tp_base_call_channel_maybe_initizalised (self); } /** @@ -1302,6 +1311,9 @@ _tp_base_call_channel_maybe_initizalised (TpBaseCallChannel *self) g_return_if_fail (TP_IS_BASE_CALL_CHANNEL (self)); + if (self->priv->state != TP_CALL_STATE_INITIALISING) + return; + /* This is called from TpCallStreamEndpoint when it is connected. Check if * they are all connected now. */ for (l = self->priv->contents; l != NULL; l = l->next) @@ -1318,9 +1330,11 @@ _tp_base_call_channel_maybe_initizalised (TpBaseCallChannel *self) endpoints = tp_base_media_call_stream_get_endpoints (streams->data); for (; endpoints != NULL; endpoints = endpoints->next) { - if (tp_call_stream_endpoint_get_state (endpoints->data, - TP_STREAM_COMPONENT_DATA) != - TP_STREAM_ENDPOINT_STATE_PROVISIONALLY_CONNECTED) + TpStreamEndpointState state = tp_call_stream_endpoint_get_state ( + endpoints->data, TP_STREAM_COMPONENT_DATA); + + if (state != TP_STREAM_ENDPOINT_STATE_PROVISIONALLY_CONNECTED && + state != TP_STREAM_ENDPOINT_STATE_FULLY_CONNECTED) return; } } |