[telepathy-qt4/master] IncomingFileTransferChannel: Make acceptFile require FileTransferChannel::FeatureCore.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Thu Sep 17 11:22:42 PDT 2009
This is needed cause the handling of acceptFile requires a proper
FileTransferStateChanged handling.
---
TelepathyQt4/incoming-file-transfer-channel.cpp | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/TelepathyQt4/incoming-file-transfer-channel.cpp b/TelepathyQt4/incoming-file-transfer-channel.cpp
index 7eb3e1e..6de0dfa 100644
--- a/TelepathyQt4/incoming-file-transfer-channel.cpp
+++ b/TelepathyQt4/incoming-file-transfer-channel.cpp
@@ -115,6 +115,8 @@ IncomingFileTransferChannel::~IncomingFileTransferChannel()
* The given output device should not be closed/destroyed until the state()
* changes to %FileTransferStateCompleted or %FileTransferStateCancelled.
*
+ * This method requires FileTransferChannel::FeatureCore to be enabled.
+ *
* \param offset The desired offset in bytes where the file transfer should
* start. The offset is taken from the beginning of the file.
* Specifying an offset of zero will start the transfer from the
@@ -136,6 +138,13 @@ IncomingFileTransferChannel::~IncomingFileTransferChannel()
PendingOperation *IncomingFileTransferChannel::acceptFile(qulonglong offset,
QIODevice *output)
{
+ if (!isReady(FileTransferChannel::FeatureCore)) {
+ warning() << "FileTransferChannel::FeatureCore must be ready before "
+ "calling acceptFile";
+ return new PendingFailure(this, TELEPATHY_ERROR_NOT_AVAILABLE,
+ "Channel not ready");
+ }
+
// let's fail here direclty as we may only have one device to handle
if (mPriv->output) {
warning() << "File transfer can only be started once in the same "
--
1.5.6.5
More information about the telepathy-commits
mailing list