summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2012-03-05 16:41:48 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2012-03-05 16:41:48 -0500
commit1ed8c5746c9a379a0b9eedfa20770452a9c29eb2 (patch)
tree9d9a129d0e0d888757cdfb1a2abd83a252ba7b32
parent6ec1a93f027280c59b014e9d22e23c1d041c4c1b (diff)
downloadtelepathy-farstream-1ed8c5746c9a379a0b9eedfa20770452a9c29eb2.tar.gz
Make it possible to remove a endpoint
-rw-r--r--telepathy-farstream/call-stream.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/telepathy-farstream/call-stream.c b/telepathy-farstream/call-stream.c
index 81a3d44..113af18 100644
--- a/telepathy-farstream/call-stream.c
+++ b/telepathy-farstream/call-stream.c
@@ -129,6 +129,9 @@ tf_call_stream_update_sending_state (TfCallStream *self)
if (self->fsstream == NULL)
goto done;
+ if (self->endpoint == NULL)
+ goto done;
+
switch (self->sending_state)
{
case TP_STREAM_FLOW_STATE_PENDING_START:
@@ -719,6 +722,9 @@ remote_candidates_added (TpProxy *proxy,
if (!self->has_endpoint_properties)
return;
+ if (self->endpoint != proxy)
+ return;
+
tf_call_stream_add_remote_candidates (self, arg_Candidates);
}
@@ -730,6 +736,9 @@ remote_credentials_set (TpProxy *proxy,
{
TfCallStream *self = TF_CALL_STREAM (weak_object);
+ if (self->endpoint != proxy)
+ return;
+
if ((self->creds_username && strcmp (self->creds_username, arg_Username)) ||
(self->creds_password && strcmp (self->creds_password, arg_Password)))
{
@@ -761,6 +770,9 @@ got_endpoint_properties (TpProxy *proxy, GHashTable *out_Properties,
gboolean valid = FALSE;
guint transport_type;
+ if (self->endpoint != proxy)
+ return;
+
if (error)
{
tf_call_stream_fail (self,
@@ -824,6 +836,7 @@ got_endpoint_properties (TpProxy *proxy, GHashTable *out_Properties,
tf_call_stream_add_remote_candidates (self, candidates);
+ tf_call_stream_update_sending_state (self);
return;
@@ -919,16 +932,35 @@ endpoints_changed (TpCallStream *proxy,
if (!self->has_media_properties)
return;
- if (arg_Endpoints_Removed->len != 0)
+ if (arg_Endpoints_Removed->len == 1)
+ {
+ if (self->endpoint_objpath == NULL ||
+ strcmp (self->endpoint_objpath,
+ g_ptr_array_index (arg_Endpoints_Removed, 0)))
+
+ {
+ tf_call_stream_fail_literal (self,
+ TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
+ TP_ERROR_STR_CONFUSED,
+ "Can not remove endpoint that has not been previously added");
+ return;
+ }
+ _tf_call_stream_remove_endpoint (self);
+ }
+ else if (arg_Endpoints_Removed->len > 1)
{
tf_call_stream_fail_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_NOT_IMPLEMENTED,
- "Removing Endpoints is not implemented");
+ "Having more than one endpoint is not implemented");
return;
}
- if (arg_Endpoints_Added->len != 1)
+ /* Nothing added, it's over */
+ if (arg_Endpoints_Added->len == 0)
+ return;
+
+ if (arg_Endpoints_Added->len > 1)
{
tf_call_stream_fail_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
@@ -1468,15 +1500,19 @@ cb_fs_new_active_candidate_pair (TfCallStream *stream,
FsCandidate *local_candidate,
FsCandidate *remote_candidate)
{
- GValueArray *local_tp_candidate =
- fscandidate_to_tpcandidate (stream, local_candidate);
- GValueArray *remote_tp_candidate =
- fscandidate_to_tpcandidate (stream, remote_candidate);
+ GValueArray *local_tp_candidate;
+ GValueArray *remote_tp_candidate;
g_debug ("new active candidate pair local: %s (%d) remote: %s (%d)",
local_candidate->ip, local_candidate->port,
remote_candidate->ip, remote_candidate->port);
+ if (!stream->endpoint)
+ return;
+
+ local_tp_candidate =_to_tpcandidate (stream, local_candidate);
+ remote_tp_candidate = fscandidate_to_tpcandidate (stream, remote_candidate);
+
tp_cli_call_stream_endpoint_call_set_selected_candidate_pair (
stream->endpoint, -1, local_tp_candidate, remote_tp_candidate,
NULL, NULL, NULL, NULL);