[telepathy-gabble/telepathy-gabble-0.8] gabble_file_transfer_channel_accept_file: check that channel is an incoming one

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Mon Sep 14 04:08:47 PDT 2009


This fix the first part of fd.o #23903.
---
 src/ft-channel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/ft-channel.c b/src/ft-channel.c
index 2b4c4cd..650e108 100644
--- a/src/ft-channel.c
+++ b/src/ft-channel.c
@@ -1408,8 +1408,17 @@ gabble_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer *iface,
                                           DBusGMethodInvocation *context)
 {
   GabbleFileTransferChannel *self = GABBLE_FILE_TRANSFER_CHANNEL (iface);
+  TpBaseConnection *base_conn = (TpBaseConnection *) self->priv->connection;
   GError *error = NULL;
 
+  if (self->priv->initiator == base_conn->self_handle)
+    {
+      g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+          "Channel is not an incoming transfer");
+      dbus_g_method_return_error (context, error);
+      return;
+    }
+
   if (self->priv->state != TP_FILE_TRANSFER_STATE_PENDING)
     {
       g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
-- 
1.5.6.5




More information about the telepathy-commits mailing list