aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppIqHandling.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-10-16 21:52:26 +0200
committerLinus Jahn <lnj@kaidan.im>2022-10-17 16:26:03 +0200
commit556442eab0bdbd5b30a5fad3112d88c4b124ff5e (patch)
treec82c8d27ed353f9cd79538a0c0e7e620a481ce10 /src/client/QXmppIqHandling.cpp
parent66e5f060abe831fa08a758b9de44b29bfec8b3ba (diff)
downloadqxmpp-556442eab0bdbd5b30a5fad3112d88c4b124ff5e.tar.gz
Add automated IQ request handling functions
Diffstat (limited to 'src/client/QXmppIqHandling.cpp')
-rw-r--r--src/client/QXmppIqHandling.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/client/QXmppIqHandling.cpp b/src/client/QXmppIqHandling.cpp
new file mode 100644
index 00000000..be164f0f
--- /dev/null
+++ b/src/client/QXmppIqHandling.cpp
@@ -0,0 +1,27 @@
+// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#include "QXmppIqHandling.h"
+
+void QXmpp::Private::sendIqReply(QXmppClient *client,
+ const QString &requestId,
+ const QString &requestFrom,
+ const std::optional<QXmppE2eeMetadata> &e2eeMetadata,
+ QXmppIq &&iq)
+{
+ // default type is 'result'
+ switch (iq.type()) {
+ case QXmppIq::Get:
+ case QXmppIq::Set:
+ iq.setType(QXmppIq::Result);
+ break;
+ case QXmppIq::Error:
+ case QXmppIq::Result:
+ break;
+ }
+
+ iq.setTo(requestFrom);
+ iq.setId(requestId);
+ client->reply(std::move(iq), e2eeMetadata);
+}