summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/CoreClient.cpp10
-rw-r--r--Swiften/Client/CoreClient.h7
2 files changed, 12 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_;
+}
+
}
diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h
index e9e81ec..2b7113f 100644
--- a/Swiften/Client/CoreClient.h
+++ b/Swiften/Client/CoreClient.h
@@ -96,6 +96,13 @@ namespace Swift {
}
/**
+ * Checks whether the client is active.
+ *
+ * A client is active when it is connected or connecting to the server.
+ */
+ bool isActive() const;
+
+ /**
* Returns the JID of the client.
* After the session was initialized, this returns the bound JID.
*/