diff options
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Client/ClientOptions.h | 8 | ||||
-rw-r--r-- | Swiften/Client/ClientSession.cpp | 5 | ||||
-rw-r--r-- | Swiften/Client/ClientSession.h | 5 | ||||
-rw-r--r-- | Swiften/Client/CoreClient.cpp | 1 |
4 files changed, 16 insertions, 3 deletions
diff --git a/Swiften/Client/ClientOptions.h b/Swiften/Client/ClientOptions.h index 6b15f18..3b51a87 100644 --- a/Swiften/Client/ClientOptions.h +++ b/Swiften/Client/ClientOptions.h @@ -14,7 +14,7 @@ namespace Swift { RequireTLS }; - ClientOptions() : useStreamCompression(true), useTLS(UseTLSWhenAvailable), allowPLAINWithoutTLS(false), useStreamResumption(false), forgetPassword(false) { + ClientOptions() : useStreamCompression(true), useTLS(UseTLSWhenAvailable), allowPLAINWithoutTLS(false), useStreamResumption(false), forgetPassword(false), useAcks(true) { } /** @@ -55,5 +55,11 @@ namespace Swift { * Default: false */ bool forgetPassword; + + /** + * Use XEP-0198 acks in the stream when available. + * Default: true + */ + bool useAcks; }; } diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index 2eeb3c0..275f913 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -57,7 +57,8 @@ ClientSession::ClientSession( needAcking(false), rosterVersioningSupported(false), authenticator(NULL), - certificateTrustChecker(NULL) { + certificateTrustChecker(NULL), + useAcks(true) { } ClientSession::~ClientSession() { @@ -232,7 +233,7 @@ void ClientSession::handleElement(boost::shared_ptr<Element> element) { stream->setWhitespacePingEnabled(true); needSessionStart = streamFeatures->hasSession(); needResourceBind = streamFeatures->hasResourceBind(); - needAcking = streamFeatures->hasStreamManagement(); + needAcking = streamFeatures->hasStreamManagement() && useAcks; if (!needResourceBind) { // Resource binding is a MUST finishSession(Error::ResourceBindError); diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index e58e758..939e96e 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -85,6 +85,10 @@ namespace Swift { useTLS = b; } + void setUseAcks(bool b) { + useAcks = b; + } + bool getStreamManagementEnabled() const { return stanzaAckRequester_; @@ -159,6 +163,7 @@ namespace Swift { bool needResourceBind; bool needAcking; bool rosterVersioningSupported; + bool useAcks; ClientAuthenticator* authenticator; boost::shared_ptr<StanzaAckRequester> stanzaAckRequester_; boost::shared_ptr<StanzaAckResponder> stanzaAckResponder_; diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index 37055e4..a223e3d 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -123,6 +123,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio session_->setUseTLS(ClientSession::RequireTLS); break; } + session_->setUseAcks(options.useAcks); stanzaChannel_->setSession(session_); session_->onFinished.connect(boost::bind(&CoreClient::handleSessionFinished, this, _1)); session_->onNeedCredentials.connect(boost::bind(&CoreClient::handleNeedCredentials, this)); |