diff options
| author | Linus Jahn <lnj@kaidan.im> | 2015-10-24 00:19:25 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2018-10-29 21:41:31 +0100 |
| commit | 5559ed29681d031f36e7a7d011e3ec4bec3635f5 (patch) | |
| tree | b639a8c68f1d1255b5528bde34412ffc64a34fb6 /src/client/QXmppOutgoingClient.cpp | |
| parent | 3e2ca3c04a5a681fa97ebabf6f31b301ec9753a0 (diff) | |
| download | qxmpp-5559ed29681d031f36e7a7d011e3ec4bec3635f5.tar.gz | |
Implement XEP-0352: Client State Indication
This commit is based on a pull request by fbeutel (GitHub) (see #87) and
was rebased and slightly modified by me.
Diffstat (limited to 'src/client/QXmppOutgoingClient.cpp')
| -rw-r--r-- | src/client/QXmppOutgoingClient.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp index 9d5043d0..04929362 100644 --- a/src/client/QXmppOutgoingClient.cpp +++ b/src/client/QXmppOutgoingClient.cpp @@ -106,6 +106,9 @@ public: QString resumeHost; quint16 resumePort; + // Client State Indication + bool clientStateIndicationEnabled; + // Timers QTimer *pingTimer; QTimer *timeoutTimer; @@ -126,6 +129,7 @@ QXmppOutgoingClientPrivate::QXmppOutgoingClientPrivate(QXmppOutgoingClient *qq) , canResume(false) , isResuming(false) , resumePort(0) + , clientStateIndicationEnabled(false) , pingTimer(0) , timeoutTimer(0) , q(qq) @@ -294,6 +298,13 @@ bool QXmppOutgoingClient::isConnected() const return QXmppStream::isConnected() && d->sessionStarted; } +/// Returns true if client state indication (xep-0352) is supported by the server + +bool QXmppOutgoingClient::isClientStateIndicationEnabled() const +{ + return d->clientStateIndicationEnabled; +} + void QXmppOutgoingClient::_q_socketDisconnected() { debug("Socket disconnected"); @@ -400,6 +411,9 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv) QXmppStreamFeatures features; features.parse(nodeRecv); + if(features.clientStateIndicationMode() == QXmppStreamFeatures::Enabled) + d->clientStateIndicationEnabled = true; + if (!socket()->isEncrypted()) { // determine TLS mode to use |
