diff options
| author | Linus Jahn <lnj@kaidan.im> | 2022-05-13 21:40:44 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-05-20 16:55:29 +0200 |
| commit | 386a5c71647ad95a7e8886dfca1bcf2bf07d5293 (patch) | |
| tree | 927a6d41fe01ec438645c9b8f3a968ea8c151f76 /src/client | |
| parent | 4714c48c8cf578deaf2488e98a9f844300dd5750 (diff) | |
| download | qxmpp-386a5c71647ad95a7e8886dfca1bcf2bf07d5293.tar.gz | |
Client: injectIq: Send error IQ on unhandled IQs
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/QXmppClient.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp index cfe798fd..a90fafed 100644 --- a/src/client/QXmppClient.cpp +++ b/src/client/QXmppClient.cpp @@ -786,7 +786,25 @@ QXmppVersionManager &QXmppClient::versionManager() void QXmppClient::injectIq(const QDomElement &element, const std::optional<QXmppE2eeMetadata> &e2eeMetadata) { - StanzaPipeline::process(d->extensions, element, e2eeMetadata); + if (element.tagName() != "iq") { + return; + } + if (!StanzaPipeline::process(d->extensions, element, e2eeMetadata)) { + const auto iqType = element.attribute("type"); + if (iqType == "get" || iqType == "set") { + // send error IQ + using Err = QXmppStanza::Error; + + QXmppIq iq(QXmppIq::Error); + iq.setTo(element.attribute("from")); + const auto errMessage = e2eeMetadata.has_value() + ? QStringLiteral("Feature not implemented or not supported with end-to-end encryption.") + : QStringLiteral("Feature not implemented."); + iq.setError(Err(Err::Cancel, Err::FeatureNotImplemented, errMessage)); + reply(std::move(iq), e2eeMetadata); + } + // don't do anything for "result" and "error" IQs + } } /// |
