[telepathy-gabble/master] Ensure Accept isn't called in an invalid state.

Mike Ruprecht mike.ruprecht at collabora.co.uk
Mon Jan 18 19:50:36 PST 2010


---
 src/call-channel.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/call-channel.c b/src/call-channel.c
index d796492..7882e1c 100644
--- a/src/call-channel.c
+++ b/src/call-channel.c
@@ -872,16 +872,32 @@ gabble_call_channel_accept (GabbleSvcChannelTypeCall *iface,
           priv->state = GABBLE_CALL_STATE_PENDING_RECEIVER;
           emit_call_state_changed (self);
         }
+      else
+        {
+          goto err;
+        }
     }
   else if (priv->state < GABBLE_CALL_STATE_ACCEPTED)
     {
       priv->state = GABBLE_CALL_STATE_ACCEPTED;
       emit_call_state_changed (self);
     }
+  else
+    {
+      goto err;
+    }
 
   gabble_jingle_session_accept (self->priv->session);
 
   gabble_svc_channel_type_call_return_from_accept (context);
+  return;
+
+err:
+  {
+    GError e = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+        "Invalid state for Accept" };
+    dbus_g_method_return_error (context, &e);
+  }
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list