diff options
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp')
-rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp new file mode 100644 index 0000000..bf7d4e8 --- /dev/null +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h> + +#include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h> + +#include <boost/bind.hpp> + +namespace Swift { + +SOCKS5BytestreamServerResourceUser::SOCKS5BytestreamServerResourceUser(SOCKS5BytestreamServerManager* s5bServerManager) : s5bServerManager_(s5bServerManager) { + assert(!s5bServerManager_->isInitialized()); + s5bServerManager_->onInitialized.connect(boost::bind(&SOCKS5BytestreamServerResourceUser::handleServerManagerInitialized, this, _1)); + s5bServerManager_->initialize(); +} + +SOCKS5BytestreamServerResourceUser::~SOCKS5BytestreamServerResourceUser() { + if (s5bServerManager_->isInitialized()) { + s5bServerManager_->stop(); + } +} + +bool SOCKS5BytestreamServerResourceUser::isInitialized() const { + return s5bServerManager_->isInitialized(); +} + +void SOCKS5BytestreamServerResourceUser::handleServerManagerInitialized(bool successfulInitialize) { + onSuccessfulInitialized(successfulInitialize); +} + +} |