summaryrefslogtreecommitdiffstats
blob: b3693477eae21d6e09e5a2bd34c934b6c6e24e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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());
	onInitializedConnection_ = 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);
}

}