summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamServerInitializeRequest.cpp')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerInitializeRequest.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerInitializeRequest.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerInitializeRequest.cpp
new file mode 100644
index 0000000..38735de
--- /dev/null
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerInitializeRequest.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/FileTransfer/SOCKS5BytestreamServerInitializeRequest.h>
+
+#include <boost/bind.hpp>
+
+#include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h>
+
+using namespace Swift;
+
+SOCKS5BytestreamServerInitializeRequest::SOCKS5BytestreamServerInitializeRequest(SOCKS5BytestreamServerManager* manager) : manager(manager) {
+}
+
+SOCKS5BytestreamServerInitializeRequest::~SOCKS5BytestreamServerInitializeRequest() {
+}
+
+void SOCKS5BytestreamServerInitializeRequest::start() {
+ if (manager->isInitialized()) {
+ handleInitialized(true);
+ }
+ else {
+ manager->onInitialized.connect(
+ boost::bind(&SOCKS5BytestreamServerInitializeRequest::handleInitialized, this, _1));
+ manager->initialize();
+ }
+}
+
+void SOCKS5BytestreamServerInitializeRequest::stop() {
+ manager->onInitialized.disconnect(
+ boost::bind(&SOCKS5BytestreamServerInitializeRequest::handleInitialized, this, _1));
+}
+
+void SOCKS5BytestreamServerInitializeRequest::handleInitialized(bool success) {
+ onFinished(success);
+}