diff options
author | Tobias Fella <fella@posteo.de> | 2021-09-10 17:55:20 +0200 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-09-10 21:41:25 +0200 |
commit | 8dfa505066a03cc8450527699634fda71cbd8915 (patch) | |
tree | 3116beac2c4423599ed9fd362146f0f998acb000 /lib/mxcreply.cpp | |
parent | 3b383a6dcb75531ca7efcaa4afa28b92dbe15e3e (diff) | |
download | libquotient-8dfa505066a03cc8450527699634fda71cbd8915.tar.gz libquotient-8dfa505066a03cc8450527699634fda71cbd8915.zip |
Return a failed MxcReply on invalid requests
Diffstat (limited to 'lib/mxcreply.cpp')
-rw-r--r-- | lib/mxcreply.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/mxcreply.cpp b/lib/mxcreply.cpp index f389ac85..7819367e 100644 --- a/lib/mxcreply.cpp +++ b/lib/mxcreply.cpp @@ -4,6 +4,7 @@ #include "mxcreply.h" #include <QtCore/QBuffer> +#include <QtCore/QTimer> #include "connection.h" #include "room.h" #include "networkaccessmanager.h" @@ -40,6 +41,20 @@ MxcReply::MxcReply(QNetworkReply* reply, Room* room, const QString &eventId) }); } +MxcReply::MxcReply() +{ + QTimer::singleShot(0, this, [this](){ + setError(QNetworkReply::ProtocolInvalidOperationError, QStringLiteral("Invalid Request")); + setFinished(true); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + Q_EMIT errorOccurred(QNetworkReply::ProtocolInvalidOperationError); +#else + Q_EMIT error(QNetworkReply::ProtocolInvalidOperationError); +#endif + Q_EMIT finished(); + }); +} + bool MxcReply::isSequential() const { return true; |