diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-07 14:58:23 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-07 18:04:57 (GMT) |
commit | e2f2e48f6e01739ccaa763ff7f037306131d4e61 (patch) | |
tree | 92fefe8ff9255356d849d1eadcad45666bde52e5 /Swiften/Client/CoreClient.h | |
parent | 832d109bfabc16ef2834790743c1d235b254d781 (diff) | |
download | swift-contrib-e2f2e48f6e01739ccaa763ff7f037306131d4e61.zip swift-contrib-e2f2e48f6e01739ccaa763ff7f037306131d4e61.tar.bz2 |
Added security error handling to Swiften.
Diffstat (limited to 'Swiften/Client/CoreClient.h')
-rw-r--r-- | Swiften/Client/CoreClient.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 4170e8d..3176a51 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -32,6 +32,7 @@ namespace Swift { class ClientSession; class BasicSessionStream; class EventLoop; + class SecurityError; /** * The central class for communicating with an XMPP server. @@ -71,6 +72,14 @@ namespace Swift { void connect(const String& host); /** + * Instructs the client to continue initializing the session + * after a security error has occurred (and as such ignoring the error) + * + * \see onSecurityError + */ + void continueAfterSecurityError(); + + /** * Sends a message. */ void sendMessage(Message::ref); @@ -131,8 +140,29 @@ namespace Swift { return stanzaChannel_; } + /** + * Sets whether security errors should be ignored or not. + * + * If this is set to 'true', onSecurityError will not be called when a security + * error occurs, and connecting will continue. + * + * Defaults to true. + */ + void setIgnoreSecurityErrors(bool b) { + ignoreSecurityErrors = b; + } + public: /** + * Emitted when an error occurred while establishing a secure connection. + * + * If the error is to be ignored, call continueAfterSecurityError(), otherwise call + * finish(). + * This signal is not emitted when setIgnoreSecurityErrors() is set to true. + */ + boost::signal<void (const SecurityError&)> onSecurityError; + + /** * Emitted when the client was disconnected from the network. * * If the connection was due to a non-recoverable error, the type @@ -187,6 +217,7 @@ namespace Swift { void handleNeedCredentials(); void handleDataRead(const String&); void handleDataWritten(const String&); + void handleSecurityError(const SecurityError& securityError); private: PlatformDomainNameResolver resolver_; @@ -206,5 +237,6 @@ namespace Swift { boost::shared_ptr<ClientSession> session_; String certificate_; bool disconnectRequested_; + bool ignoreSecurityErrors; }; } |