diff options
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/ClientOptions.h | 89 | ||||
-rw-r--r-- | Swiften/Client/CoreClient.cpp | 1 |
2 files changed, 50 insertions, 40 deletions
diff --git a/Swiften/Client/ClientOptions.h b/Swiften/Client/ClientOptions.h index cc80dc2..0766402 100644 --- a/Swiften/Client/ClientOptions.h +++ b/Swiften/Client/ClientOptions.h @@ -6,44 +6,53 @@ #pragma once -struct ClientOptions { - enum UseTLS { - NeverUseTLS, - UseTLSWhenAvailable +namespace Swift { + struct ClientOptions { + enum UseTLS { + NeverUseTLS, + UseTLSWhenAvailable + }; + + ClientOptions() : useStreamCompression(true), useTLS(UseTLSWhenAvailable), allowPLAINWithoutTLS(false), useStreamResumption(false), forgetPassword(false) { + } + + /** + * Whether ZLib stream compression should be used when available. + * + * Default: true + */ + bool useStreamCompression; + + /** + * Sets whether TLS encryption should be used. + * + * Default: UseTLSWhenAvailable + */ + UseTLS useTLS; + + /** + * Sets whether plaintext authentication is + * allowed over non-TLS-encrypted connections. + * + * Default: false + */ + bool allowPLAINWithoutTLS; + + /** + * Use XEP-196 stream resumption when available. + * + * Default: false + */ + bool useStreamResumption; + + /** + * Forget the password once it's used. + * This makes the Client useless after the first login attempt. + * + * FIXME: This is a temporary workaround. + * + * Default: false + */ + bool forgetPassword; }; - - ClientOptions() : useStreamCompression(true), useTLS(UseTLSWhenAvailable), useStreamResumption(false), forgetPassword(false) { - } - - /** - * Whether ZLib stream compression should be used when available. - * - * Default: true - */ - bool useStreamCompression; - - /** - * Sets whether TLS encryption should be used. - * - * Default: UseTLSWhenAvailable - */ - UseTLS useTLS; - - /** - * Use XEP-196 stream resumption when available. - * - * Default: false - */ - bool useStreamResumption; - - /** - * Forget the password once it's used. - * This makes the Client useless after the first login attempt. - * - * FIXME: This is a temporary workaround. - * - * Default: false - */ - bool forgetPassword; -}; - +} diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index a2708c5..ab9e947 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -109,6 +109,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio session_ = ClientSession::create(jid_, sessionStream_); session_->setCertificateTrustChecker(certificateTrustChecker); session_->setUseStreamCompression(options.useStreamCompression); + session_->setAllowPLAINOverNonTLS(options.allowPLAINWithoutTLS); switch(options.useTLS) { case ClientOptions::UseTLSWhenAvailable: session_->setUseTLS(ClientSession::UseTLSWhenAvailable); |