[telepathy-gabble/master] Make SessionHandler.Ready() fail if session is over
Will Thompson
will.thompson at collabora.co.uk
Mon May 11 09:50:40 PDT 2009
---
src/media-channel.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/media-channel.c b/src/media-channel.c
index cc00bd8..86d1f96 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2770,10 +2770,28 @@ gabble_media_channel_ready (TpSvcMediaSessionHandler *iface,
GabbleMediaChannel *self = GABBLE_MEDIA_CHANNEL (iface);
GabbleMediaChannelPrivate *priv = self->priv;
+ if (priv->session == NULL)
+ {
+ /* This could also be because someone called Ready() before the
+ * SessionHandler was announced. But the fact that the SessionHandler is
+ * actually also the Channel, and thus this method is available before
+ * NewSessionHandler is emitted, is an implementation detail. So the
+ * error message describes the only legitimate situation in which this
+ * could arise.
+ */
+ GError e = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE, "call has already ended" };
+
+ DEBUG ("no session, returning an error.");
+ dbus_g_method_return_error (context, &e);
+ return;
+ }
+
if (!priv->ready)
{
guint i;
+ DEBUG ("emitting NewStreamHandler for each stream");
+
priv->ready = TRUE;
for (i = 0; i < priv->streams->len; i++)
--
1.5.6.5
More information about the telepathy-commits
mailing list