aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppMessage.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2023-05-15 00:00:35 +0200
committerGitHub <noreply@github.com>2023-05-15 00:00:35 +0200
commit6fe82239fc55b16953f965ea4e20e5fbfe806dd5 (patch)
tree8c640ff269f527c7685d07a82517ba040d4d8e7f /src/base/QXmppMessage.cpp
parentfbb96a37f1c118c14fd158173e0d691022183ee3 (diff)
parent85006abce021819de6af389d04e88756fac0745a (diff)
Merge pull request #570 from taiBsu/feature/jingle-message-initiationHEADmaster
XEP-0353: Jingle Message Initiation
Diffstat (limited to 'src/base/QXmppMessage.cpp')
-rw-r--r--src/base/QXmppMessage.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/base/QXmppMessage.cpp b/src/base/QXmppMessage.cpp
index 9527f5ed..be6cd83e 100644
--- a/src/base/QXmppMessage.cpp
+++ b/src/base/QXmppMessage.cpp
@@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
// SPDX-FileCopyrightText: 2018 Linus Jahn <lnj@kaidan.im>
// SPDX-FileCopyrightText: 2021 Melvin Keskin <melvo@olomono.de>
+// SPDX-FileCopyrightText: 2023 Tibor Csötönyi <work@taibsu.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
@@ -11,6 +12,7 @@
#include "QXmppConstants_p.h"
#include "QXmppFileShare.h"
#include "QXmppGlobal_p.h"
+#include "QXmppJingleData.h"
#include "QXmppMessageReaction.h"
#include "QXmppMixInvitation.h"
#ifdef BUILD_OMEMO
@@ -123,6 +125,9 @@ public:
// XEP-0334: Message Processing Hints
quint8 hints;
+ // XEP-0353: Jingle Message Initiation
+ std::optional<QXmppJingleMessageInitiationElement> jingleMessageInitiationElement;
+
// XEP-0359: Unique and Stable Stanza IDs
QString stanzaId;
QString stanzaIdBy;
@@ -872,6 +877,24 @@ void QXmppMessage::removeAllHints()
}
///
+/// Returns a Jingle Message Initiation element as defined in \xep{0353}: Jingle Message
+/// Initiation.
+///
+std::optional<QXmppJingleMessageInitiationElement> QXmppMessage::jingleMessageInitiationElement() const
+{
+ return d->jingleMessageInitiationElement;
+}
+
+///
+/// Sets a Jingle Message Initiation element as defined in \xep{0353}: Jingle Message
+/// Initiation.
+///
+void QXmppMessage::setJingleMessageInitiationElement(const std::optional<QXmppJingleMessageInitiationElement> &jingleMessageInitiationElement)
+{
+ d->jingleMessageInitiationElement = jingleMessageInitiationElement;
+}
+
+///
/// Returns the stanza ID of the message according to \xep{0359}: Unique and
/// Stable Stanza IDs.
///
@@ -1393,6 +1416,13 @@ bool QXmppMessage::parseExtension(const QDomElement &element, QXmpp::SceMode sce
}
return true;
}
+ // XEP-0353: Jingle Message Initiation
+ if (QXmppJingleMessageInitiationElement::isJingleMessageInitiationElement(element)) {
+ QXmppJingleMessageInitiationElement jingleMessageInitiationElement;
+ jingleMessageInitiationElement.parse(element);
+ d->jingleMessageInitiationElement = jingleMessageInitiationElement;
+ return true;
+ }
// XEP-0359: Unique and Stable Stanza IDs
if (checkElement(element, QStringLiteral("stanza-id"), ns_sid)) {
d->stanzaId = element.attribute(QStringLiteral("id"));
@@ -1811,6 +1841,11 @@ void QXmppMessage::serializeExtensions(QXmlStreamWriter *writer, QXmpp::SceMode
writer->writeEndElement();
}
+ // XEP-0353: Jingle Message Initiation
+ if (d->jingleMessageInitiationElement) {
+ d->jingleMessageInitiationElement->toXml(writer);
+ }
+
// XEP-0367: Message Attaching
if (!d->attachId.isEmpty()) {
writer->writeStartElement(QStringLiteral("attach-to"));