aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-dispatch-operation.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-01-10 00:14:52 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-10 00:14:52 +0800
commitc571f0fe419c356c96db3338c4eb2a7e65f4728c (patch)
tree2f63ef413f29428a74557e37f33fd07c8596b372 /libempathy/empathy-dispatch-operation.c
parent8b62c532134177bd301e1a1a1ea6c8616d508767 (diff)
downloadgsoc2013-empathy-c571f0fe419c356c96db3338c4eb2a7e65f4728c.tar.gz
gsoc2013-empathy-c571f0fe419c356c96db3338c4eb2a7e65f4728c.tar.zst
gsoc2013-empathy-c571f0fe419c356c96db3338c4eb2a7e65f4728c.zip
Always check if the passed operation is actually a dispatch operation
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> svn path=/trunk/; revision=2178
Diffstat (limited to 'libempathy/empathy-dispatch-operation.c')
-rw-r--r--libempathy/empathy-dispatch-operation.c68
1 files changed, 57 insertions, 11 deletions
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index d0496cb78..c623dbfd2 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -439,7 +439,12 @@ empathy_dispatch_operation_new_with_wrapper (TpConnection *connection,
void
empathy_dispatch_operation_start (EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation));
+
+ priv = GET_PRIV (operation);
+
g_return_if_fail (
priv->status == EMPATHY_DISPATCHER_OPERATION_STATE_PENDING);
@@ -454,7 +459,11 @@ empathy_dispatch_operation_start (EmpathyDispatchOperation *operation)
void
empathy_dispatch_operation_approve (EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation));
+
+ priv = GET_PRIV (operation);
if (priv->status == EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING)
{
@@ -478,7 +487,11 @@ empathy_dispatch_operation_approve (EmpathyDispatchOperation *operation)
gboolean
empathy_dispatch_operation_claim (EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), FALSE);
+
+ priv = GET_PRIV (operation);
if (priv->status == EMPATHY_DISPATCHER_OPERATION_STATE_CLAIMED)
return FALSE;
@@ -495,7 +508,11 @@ TpConnection *
empathy_dispatch_operation_get_tp_connection (
EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), NULL);
+
+ priv = GET_PRIV (operation);
return g_object_ref (priv->connection);
}
@@ -503,7 +520,11 @@ empathy_dispatch_operation_get_tp_connection (
TpChannel *
empathy_dispatch_operation_get_channel (EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), NULL);
+
+ priv = GET_PRIV (operation);
return TP_CHANNEL (g_object_ref (priv->channel));
}
@@ -512,7 +533,11 @@ GObject *
empathy_dispatch_operation_get_channel_wrapper (
EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), NULL);
+
+ priv = GET_PRIV (operation);
if (priv->channel_wrapper != NULL)
g_object_ref (priv->channel_wrapper);
@@ -524,7 +549,11 @@ const gchar *
empathy_dispatch_operation_get_channel_type (
EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), NULL);
+
+ priv = GET_PRIV (operation);
return tp_channel_get_channel_type (priv->channel);
}
@@ -533,7 +562,11 @@ GQuark
empathy_dispatch_operation_get_channel_type_id (
EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), 0);
+
+ priv = GET_PRIV (operation);
return tp_channel_get_channel_type_id (priv->channel);
}
@@ -542,7 +575,11 @@ const gchar *
empathy_dispatch_operation_get_object_path (
EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), NULL);
+
+ priv = GET_PRIV (operation);
return tp_proxy_get_object_path (TP_PROXY (priv->channel));
}
@@ -550,7 +587,12 @@ empathy_dispatch_operation_get_object_path (
EmpathyDispatchOperationState
empathy_dispatch_operation_get_status (EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation),
+ EMPATHY_DISPATCHER_OPERATION_STATE_PREPARING);
+
+ priv = GET_PRIV (operation);
return priv->status;
}
@@ -558,7 +600,11 @@ empathy_dispatch_operation_get_status (EmpathyDispatchOperation *operation)
gboolean
empathy_dispatch_operation_is_incoming (EmpathyDispatchOperation *operation)
{
- EmpathyDispatchOperationPriv *priv = GET_PRIV (operation);
+ EmpathyDispatchOperationPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation), FALSE);
+
+ priv = GET_PRIV (operation);
return priv->incoming;
}