summaryrefslogtreecommitdiff
path: root/telepathy-glib
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-20 13:44:01 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-20 13:44:01 +0200
commit6d3c8df3cd918cf76abae7d5c43f84bfca6ed59d (patch)
tree745e32f4acbe9b459a1393c1bb2c0003ec05d336 /telepathy-glib
parent1bbda3bc12ba8b22c7d004ca82915e35d7496c4d (diff)
downloadtelepathy-glib-6d3c8df3cd918cf76abae7d5c43f84bfca6ed59d.tar.gz
base-call-channel: include the expected and current state in Accept error message
I'm debugging an Empathy call issue and this kind of info can be useful.
Diffstat (limited to 'telepathy-glib')
-rw-r--r--telepathy-glib/base-call-channel.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/telepathy-glib/base-call-channel.c b/telepathy-glib/base-call-channel.c
index 067c22f7f..af82ba1b1 100644
--- a/telepathy-glib/base-call-channel.c
+++ b/telepathy-glib/base-call-channel.c
@@ -1341,6 +1341,22 @@ tp_base_call_channel_set_queued (TpSvcChannelTypeCall *iface,
}
static void
+raise_accept_state_error (TpBaseCallChannel *self,
+ TpCallState expected,
+ DBusGMethodInvocation *context)
+{
+ GError *e = NULL;
+
+ e = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ "Invalid state for Accept (expected: %s, current: %s)",
+ call_state_to_string (expected),
+ call_state_to_string (self->priv->state));
+
+ dbus_g_method_return_error (context, e);
+ g_error_free (e);
+}
+
+static void
tp_base_call_channel_accept (TpSvcChannelTypeCall *iface,
DBusGMethodInvocation *context)
{
@@ -1364,9 +1380,8 @@ tp_base_call_channel_accept (TpSvcChannelTypeCall *iface,
}
else
{
- GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "Invalid state for Accept" };
- dbus_g_method_return_error (context, &e);
+ raise_accept_state_error (self, TP_CALL_STATE_PENDING_INITIATOR,
+ context);
return;
}
}
@@ -1382,9 +1397,8 @@ tp_base_call_channel_accept (TpSvcChannelTypeCall *iface,
}
else
{
- GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "Invalid state for Accept" };
- dbus_g_method_return_error (context, &e);
+ raise_accept_state_error (self, TP_CALL_STATE_INITIALISED,
+ context);
return;
}
self->priv->accepted = TRUE;