diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2011-12-16 18:57:33 -0500 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-01-10 09:52:46 +0100 |
commit | fb77554c3f5304ec332b6037476a9d68d8ea8656 (patch) | |
tree | f4f7df17c21231bcae9c087cf16815b9fc1bdb67 /telepathy-glib/base-call-stream.c | |
parent | 24becc3d5895f280f666c9887da2c88a05e20045 (diff) | |
download | telepathy-glib-fb77554c3f5304ec332b6037476a9d68d8ea8656.tar.gz |
Implement the sending/receiving states in TpBaseMediaCallStream
Diffstat (limited to 'telepathy-glib/base-call-stream.c')
-rw-r--r-- | telepathy-glib/base-call-stream.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/telepathy-glib/base-call-stream.c b/telepathy-glib/base-call-stream.c index f9e773729..30cff81b7 100644 --- a/telepathy-glib/base-call-stream.c +++ b/telepathy-glib/base-call-stream.c @@ -596,6 +596,7 @@ tp_base_call_stream_update_remote_sending_state (TpBaseCallStream *self, g_hash_table_insert (self->priv->remote_members, GUINT_TO_POINTER (contact), GUINT_TO_POINTER (new_state)); + g_object_notify (G_OBJECT (self), "remote-members"); updates = g_hash_table_new (g_direct_hash, g_direct_equal); g_hash_table_insert (updates, @@ -654,6 +655,7 @@ tp_base_call_stream_remove_member (TpBaseCallStream *self, if (!g_hash_table_remove (self->priv->remote_members, GUINT_TO_POINTER (contact))) return FALSE; + g_object_notify (G_OBJECT (self), "remote-members"); empty_table = g_hash_table_new (g_direct_hash, g_direct_equal); removed_array = g_array_sized_new (FALSE, TRUE, sizeof (TpHandle), 1); @@ -703,9 +705,10 @@ tp_base_call_stream_request_receiving (TpSvcCallStream *iface, TpBaseCallStream *self = TP_BASE_CALL_STREAM (iface); TpBaseCallStreamClass *klass = TP_BASE_CALL_STREAM_GET_CLASS (self); GError *error = NULL; + TpSendingState remote_sending_state; if (!g_hash_table_lookup_extended (self->priv->remote_members, - GUINT_TO_POINTER (contact), NULL, NULL)) + GUINT_TO_POINTER (contact), NULL, (gpointer*) &remote_sending_state)) { g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, "Contact %u is not member of this stream", contact); @@ -719,9 +722,29 @@ tp_base_call_stream_request_receiving (TpSvcCallStream *iface, goto error; } + /* Determine if there is a state change for our receiving side + * aka remote sending + */ + switch (remote_sending_state) + { + case TP_SENDING_STATE_NONE: + case TP_SENDING_STATE_PENDING_SEND: + if (!receiving) + goto out; + break; + case TP_SENDING_STATE_SENDING: + case TP_SENDING_STATE_PENDING_STOP_SENDING: + if (receiving) + goto out; + break; + default: + g_assert_not_reached (); + } + if (!klass->request_receiving (self, contact, receiving, &error)) goto error; + out: tp_svc_call_stream_return_from_request_receiving (context); return; @@ -820,3 +843,11 @@ out: return TRUE; } + +GHashTable * +_tp_base_call_stream_borrow_remote_members (TpBaseCallStream *stream) +{ + g_return_val_if_fail (TP_IS_BASE_CALL_STREAM (stream), NULL); + + return stream->priv->remote_members; +} |