aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppOutgoingClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/QXmppOutgoingClient.cpp')
-rw-r--r--src/client/QXmppOutgoingClient.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp
index a8bfb62d..21d2b4e5 100644
--- a/src/client/QXmppOutgoingClient.cpp
+++ b/src/client/QXmppOutgoingClient.cpp
@@ -1,26 +1,7 @@
-/*
- * Copyright (C) 2008-2021 The QXmpp developers
- *
- * Authors:
- * Manjeet Dahiya
- * Jeremy Lainé
- *
- * Source:
- * https://github.com/qxmpp-project/qxmpp
- *
- * This file is a part of QXmpp library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- */
+// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
+// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
#include "QXmppOutgoingClient.h"
@@ -213,6 +194,20 @@ QXmppOutgoingClient::QXmppOutgoingClient(QObject *parent)
connect(this, &QXmppStream::connected, this, &QXmppOutgoingClient::pingStart);
connect(this, &QXmppStream::disconnected, this, &QXmppOutgoingClient::pingStop);
+
+ // IQ response handling
+ connect(this, &QXmppStream::connected, this, [=]() {
+ if (!d->streamResumed) {
+ // we can't expect a response because this is a new stream
+ cancelOngoingIqs();
+ }
+ });
+ connect(this, &QXmppStream::disconnected, this, [=]() {
+ if (!d->canResume) {
+ // this stream can't be resumed; we can cancel all ongoing IQs
+ cancelOngoingIqs();
+ }
+ });
}
/// Destroys an outgoing client stream.
@@ -510,7 +505,7 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv)
d->bindModeAvailable = (features.bindMode() != QXmppStreamFeatures::Disabled);
d->streamManagementAvailable = (features.streamManagementMode() != QXmppStreamFeatures::Disabled);
- // chech whether the stream can be resumed
+ // check whether the stream can be resumed
if (d->streamManagementAvailable && d->canResume) {
d->isResuming = true;
QXmppStreamManagementResume streamManagementResume(lastIncomingSequenceNumber(), d->smId);