summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavol Babincak <scroolik@gmail.com>2012-04-23 22:09:01 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-24 18:04:58 (GMT)
commitfd990d0154feb63e00b7506b63530376a8bc9f01 (patch)
treed815d8541105374f6320c48aeac52cf0af6e8baa /Swift/Controllers/FileTransfer/FileTransferController.cpp
parent5cf6ef99404a08c0e9d2ed4f6df79375fda11d4a (diff)
downloadswift-contrib-fd990d0154feb63e00b7506b63530376a8bc9f01.zip
swift-contrib-fd990d0154feb63e00b7506b63530376a8bc9f01.tar.bz2
Debug messages print only if logging is enabled
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/FileTransfer/FileTransferController.cpp')
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferController.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp
index afa907d..f1fd19e 100644
--- a/Swift/Controllers/FileTransfer/FileTransferController.cpp
+++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp
@@ -5,18 +5,19 @@
*/
#include "FileTransferController.h"
#include "Swiften/FileTransfer/OutgoingJingleFileTransfer.h"
#include "Swiften/FileTransfer/FileTransferManager.h"
#include <Swiften/FileTransfer/FileReadBytestream.h>
#include <Swiften/Base/boost_bsignals.h>
#include <boost/bind.hpp>
#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
+#include <Swiften/Base/Log.h>
#include <boost/smart_ptr/make_shared.hpp>
namespace Swift {
FileTransferController::FileTransferController(const JID& receipient, const std::string& filename, FileTransferManager* fileTransferManager) :
sending(true), otherParty(receipient), filename(filename), ftManager(fileTransferManager), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) {
}
@@ -63,35 +64,35 @@ int FileTransferController::getProgress() const {
boost::uintmax_t FileTransferController::getSize() const {
if (transfer) {
return transfer->fileSizeInBytes;
} else {
return 0;
}
}
void FileTransferController::start(std::string& description) {
- std::cout << "FileTransferController::start" << std::endl;
+ SWIFT_LOG("DEBUG") << "FileTransferController::start" << std::endl;
fileReadStream = boost::make_shared<FileReadBytestream>(boost::filesystem::path(filename));
OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream);
if (outgoingTransfer) {
ftProgressInfo = new FileTransferProgressInfo(outgoingTransfer->fileSizeInBytes);
ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1));
outgoingTransfer->onStateChange.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1));
outgoingTransfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1));
outgoingTransfer->start();
transfer = outgoingTransfer;
} else {
std::cerr << "File transfer not supported!" << std::endl;
}
}
void FileTransferController::accept(std::string& file) {
- std::cout << "FileTransferController::accept" << std::endl;
+ SWIFT_LOG("DEBUG") << "FileTransferController::accept" << std::endl;
IncomingFileTransfer::ref incomingTransfer = boost::dynamic_pointer_cast<IncomingFileTransfer>(transfer);
if (incomingTransfer) {
fileWriteStream = boost::make_shared<FileWriteBytestream>(boost::filesystem::path(file));
ftProgressInfo = new FileTransferProgressInfo(transfer->fileSizeInBytes);
ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1));
transfer->onStateChange.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1));
transfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1));
incomingTransfer->accept(fileWriteStream);