summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-30 17:46:24 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-30 17:51:32 (GMT)
commitba333999576d89f3340c271b2a3331d6a3e64ac7 (patch)
tree7f2d0dd20d6d6a302a26c904468a90c22150b481 /Swiften/Client/CoreClient.cpp
parent59be74ec6fc7bc495f2a261b8f274b8555aee306 (diff)
downloadswift-ba333999576d89f3340c271b2a3331d6a3e64ac7.zip
swift-ba333999576d89f3340c271b2a3331d6a3e64ac7.tar.bz2
Disconnect client cleanly before quitting.
Resolves: #671, #420
Diffstat (limited to 'Swiften/Client/CoreClient.cpp')
-rw-r--r--Swiften/Client/CoreClient.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index 9511dfb..d9b21bc 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -62,6 +62,7 @@ void CoreClient::connect(const JID& jid) {
}
void CoreClient::connect(const String& host) {
+ disconnectRequested_ = false;
assert(!connector_);
connector_ = Connector::create(host, &resolver_, connectionFactory_, timerFactory_);
connector_->onConnectFinished.connect(boost::bind(&CoreClient::handleConnectorFinished, this, _1));
@@ -105,12 +106,7 @@ void CoreClient::disconnect() {
}
else if (connector_) {
connector_->stop();
- assert(!session_);
}
- assert(!session_);
- assert(!sessionStream_);
- assert(!connector_);
- disconnectRequested_ = false;
}
void CoreClient::setCertificate(const String& certificate) {
@@ -214,4 +210,8 @@ void CoreClient::sendPresence(boost::shared_ptr<Presence> presence) {
stanzaChannel_->sendPresence(presence);
}
+bool CoreClient::isActive() const {
+ return session_ || connector_;
+}
+
}