-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RegistrationManager: Handle failing registration form request #652
Open
melvo
wants to merge
6
commits into
qxmpp-project:master
Choose a base branch
from
olomono:fix/registration-error
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ee5f2bd
Global: Document what TimeoutError is exactly and when it occurs
melvo 96f6335
RegistrationManager: Fix class documentation
melvo 6e63e94
RegistrationManager: Document handling StreamError::ConnectionTimeout
melvo 3e964e4
RegistrationManager: Document handling corner cases during account de…
melvo bbfa81a
Set stream errors to be ignored during account creation/deletion
melvo df4152f
RegistrationManager: Handle failing registration form request
melvo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// SPDX-FileCopyrightText: 2009 Manjeet Dahiya <[email protected]> | ||
// SPDX-FileCopyrightText: 2019 Linus Jahn <[email protected]> | ||
// SPDX-FileCopyrightText: 2023 Melvin Keskin <[email protected]> | ||
// | ||
// SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
|
@@ -123,6 +124,13 @@ QStringList QXmppClientPrivate::discoveryFeatures() | |
|
||
void QXmppClientPrivate::onErrorOccurred(const QString &text, const QXmppOutgoingClient::ConnectionError &err, QXmppClient::Error oldError) | ||
{ | ||
// Skip stream errors that are valid during special procedures such as account | ||
// creation/deletion. | ||
if (const auto streamError = std::get_if<QXmpp::StreamError>(&err); | ||
streamError && ignoredStreamErrors.contains(*streamError)) { | ||
return; | ||
} | ||
|
||
if (q->configuration().autoReconnectionEnabled()) { | ||
if (oldError == QXmppClient::XmppStreamError) { | ||
// if we receive a resource conflict, inhibit reconnection | ||
|
@@ -931,6 +939,18 @@ bool QXmppClient::injectMessage(QXmppMessage &&message) | |
return handled; | ||
} | ||
|
||
/// | ||
/// Sets stream errors that are ignored if they occur. | ||
/// | ||
/// \param errors stream errors to be ignored | ||
/// | ||
/// \since QXmpp 1.9 | ||
/// | ||
void QXmppClient::setIgnoredStreamErrors(const QVector<QXmpp::StreamError> &errors) | ||
{ | ||
d->ignoredStreamErrors = errors; | ||
} | ||
|
||
/// | ||
/// Give extensions a chance to handle incoming stanzas. | ||
/// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// SPDX-FileCopyrightText: 2009 Manjeet Dahiya <[email protected]> | ||
// SPDX-FileCopyrightText: 2019 Linus Jahn <[email protected]> | ||
// SPDX-FileCopyrightText: 2023 Melvin Keskin <[email protected]> | ||
// | ||
// SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
|
@@ -11,6 +12,7 @@ | |
#include "QXmppPresence.h" | ||
#include "QXmppSendResult.h" | ||
#include "QXmppSendStanzaParams.h" | ||
#include "QXmppStreamError.h" | ||
|
||
#include <memory> | ||
#include <variant> | ||
|
@@ -321,6 +323,8 @@ public Q_SLOTS: | |
void injectIq(const QDomElement &element, const std::optional<QXmppE2eeMetadata> &e2eeMetadata); | ||
bool injectMessage(QXmppMessage &&message); | ||
|
||
void setIgnoredStreamErrors(const QVector<QXmpp::StreamError> &); | ||
|
||
private Q_SLOTS: | ||
void _q_elementReceived(const QDomElement &element, bool &handled); | ||
void _q_reconnect(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// SPDX-FileCopyrightText: 2020 Manjeet Dahiya <[email protected]> | ||
// SPDX-FileCopyrightText: 2020 Linus Jahn <[email protected]> | ||
// SPDX-FileCopyrightText: 2023 Melvin Keskin <[email protected]> | ||
// | ||
// SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
|
@@ -40,6 +41,7 @@ class QXmppClientPrivate | |
QXmppLogger *logger; | ||
/// Pointer to the XMPP stream | ||
QXmppOutgoingClient *stream; | ||
QVector<QXmpp::StreamError> ignoredStreamErrors; | ||
|
||
QXmppE2eeExtension *encryptionExtension; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change. Applications that used to listen for IQ errors on
registrationFormReceived()
won't receive any feedback now.If you want to split up the error case, create a new signal. But refactoring this to a task-based API would be more useful, I guess.