diff options
Diffstat (limited to 'Swiften')
| -rw-r--r-- | Swiften/Component/CoreComponent.cpp | 10 | ||||
| -rw-r--r-- | Swiften/Component/CoreComponent.h | 17 |
2 files changed, 22 insertions, 5 deletions
diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp index 3896bdd..5b2277b 100644 --- a/Swiften/Component/CoreComponent.cpp +++ b/Swiften/Component/CoreComponent.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Component/CoreComponent.h> @@ -164,6 +164,14 @@ void CoreComponent::sendPresence(std::shared_ptr<Presence> presence) { void CoreComponent::sendData(const std::string& data) { sessionStream_->writeData(data); } +bool CoreComponent::isActive() const { + return session_ || connector_; +} + +bool CoreComponent::isAvailable() const { + return stanzaChannel_->isAvailable(); +} + } diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h index f673643..1a487d2 100644 --- a/Swiften/Component/CoreComponent.h +++ b/Swiften/Component/CoreComponent.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2010-2017 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once @@ -59,13 +59,22 @@ namespace Swift { StanzaChannel* getStanzaChannel() const { return stanzaChannel_; } - bool isAvailable() const { - return stanzaChannel_->isAvailable(); - } + /** + * Checks whether the component is connected to the server, + * and stanzas can be sent. + */ + bool isAvailable() const; + + /** + * Checks whether the component is active. + * + * A component is active when it is connected or connecting to the server. + */ + bool isActive() const; /** * Returns the JID of the component */ const JID& getJID() const { |
Swift