aboutsummaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/QXmppConstants.cpp2
-rw-r--r--src/base/QXmppConstants_p.h2
-rw-r--r--src/base/QXmppJingleData.cpp (renamed from src/base/QXmppJingleIq.cpp)607
-rw-r--r--src/base/QXmppJingleData.h662
-rw-r--r--src/base/QXmppJingleIq.h574
-rw-r--r--src/base/QXmppMessage.cpp35
-rw-r--r--src/base/QXmppMessage.h6
7 files changed, 1234 insertions, 654 deletions
diff --git a/src/base/QXmppConstants.cpp b/src/base/QXmppConstants.cpp
index be5b62c7..0ddd3db2 100644
--- a/src/base/QXmppConstants.cpp
+++ b/src/base/QXmppConstants.cpp
@@ -160,6 +160,8 @@ const char *ns_chat_markers = "urn:xmpp:chat-markers:0";
const char *ns_message_processing_hints = "urn:xmpp:hints";
// XEP-0352: Client State Indication
const char *ns_csi = "urn:xmpp:csi:0";
+// XEP-0353: Jingle Message Initiation
+const char *ns_jingle_message_initiation = "urn:xmpp:jingle-message:0";
// XEP-0357: Push Notifications
const char *ns_push = "urn:xmpp:push:0";
// XEP-0359: Unique and Stable Stanza IDs
diff --git a/src/base/QXmppConstants_p.h b/src/base/QXmppConstants_p.h
index b90346b6..c859de96 100644
--- a/src/base/QXmppConstants_p.h
+++ b/src/base/QXmppConstants_p.h
@@ -172,6 +172,8 @@ extern const char *ns_chat_markers;
extern const char *ns_message_processing_hints;
// XEP-0352: Client State Indication
extern const char *ns_csi;
+// XEP-0353: Jingle Message Initiation
+extern const char *ns_jingle_message_initiation;
// XEP-0357: Push Notifications
extern const char *ns_push;
// XEP-0359: Unique and Stable Stanza IDs
diff --git a/src/base/QXmppJingleIq.cpp b/src/base/QXmppJingleData.cpp
index a89f87a6..ceb31b32 100644
--- a/src/base/QXmppJingleIq.cpp
+++ b/src/base/QXmppJingleData.cpp
@@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: LGPL-2.1-or-later
-#include "QXmppJingleIq.h"
+#include "QXmppJingleData.h"
#include "QXmppConstants_p.h"
#include "QXmppUtils.h"
@@ -224,9 +224,7 @@ public:
QString name;
QString senders;
- QString descriptionMedia;
- quint32 descriptionSsrc;
- QString descriptionType;
+ QXmppJingleDescription description;
bool isRtpMultiplexingSupported = false;
QString transportType;
@@ -237,7 +235,6 @@ public:
QString transportFingerprintHash;
QString transportFingerprintSetup;
- QList<QXmppJinglePayloadType> payloadTypes;
QList<QXmppJingleCandidate> transportCandidates;
// XEP-0167: Jingle RTP Sessions
@@ -253,8 +250,8 @@ public:
};
QXmppJingleIqContentPrivate::QXmppJingleIqContentPrivate()
- : descriptionSsrc(0)
{
+ description.setSsrc(0);
}
///
@@ -362,36 +359,74 @@ void QXmppJingleIq::Content::setSenders(const QString &senders)
d->senders = senders;
}
+///
+/// Returns the description as specified by
+/// \xep{0167, Jingle RTP Sessions} and RFC 3550.
+///
+/// \since QXmpp 0.9
+///
+QXmppJingleDescription QXmppJingleIq::Content::description() const
+{
+ return d->description;
+}
+
+void QXmppJingleIq::Content::setDescription(const QXmppJingleDescription &description)
+{
+ d->description = description;
+}
+
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Conent::description().media() instead.
QString QXmppJingleIq::Content::descriptionMedia() const
{
- return d->descriptionMedia;
+ return d->description.media();
}
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Conent::description().setMedia() instead.
void QXmppJingleIq::Content::setDescriptionMedia(const QString &media)
{
- d->descriptionMedia = media;
+ d->description.setMedia(media);
}
-///
/// Returns the description's 32-bit synchronization source for the media stream as specified by
/// \xep{0167, Jingle RTP Sessions} and RFC 3550.
///
/// \since QXmpp 0.9
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Content::description().setSsrc() instead.
///
quint32 QXmppJingleIq::Content::descriptionSsrc() const
{
- return d->descriptionSsrc;
+ return d->description.ssrc();
}
-///
-/// Sets the description's 32-bit synchronization source for the media stream as specified by
-/// \xep{0167, Jingle RTP Sessions} and RFC 3550.
-///
-/// \since QXmpp 0.9
-///
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Conent::description().setSsrc() instead.
void QXmppJingleIq::Content::setDescriptionSsrc(quint32 ssrc)
{
- d->descriptionSsrc = ssrc;
+ d->description.setSsrc(ssrc);
+}
+
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Conent::description().addPayloadType() instead.
+void QXmppJingleIq::Content::addPayloadType(const QXmppJinglePayloadType &payload)
+{
+ d->description.addPayloadType(payload);
+}
+
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Conent::description().payloadTypes() instead.
+QList<QXmppJinglePayloadType> QXmppJingleIq::Content::payloadTypes() const
+{
+ return d->description.payloadTypes();
+}
+
+/// \deprecated This method is deprecated since QXmpp 1.6. Use
+/// \c QXmppJingleIq::Conent::description().setPayloadTypes() instead.
+void QXmppJingleIq::Content::setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes)
+{
+ d->description.setPayloadTypes(payloadTypes);
}
///
@@ -446,23 +481,6 @@ void QXmppJingleIq::Content::setRtpEncryption(const std::optional<QXmppJingleRtp
d->rtpEncryption = rtpEncryption;
}
-void QXmppJingleIq::Content::addPayloadType(const QXmppJinglePayloadType &payload)
-{
- d->descriptionType = ns_jingle_rtp;
- d->payloadTypes << payload;
-}
-
-QList<QXmppJinglePayloadType> QXmppJingleIq::Content::payloadTypes() const
-{
- return d->payloadTypes;
-}
-
-void QXmppJingleIq::Content::setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes)
-{
- d->descriptionType = payloadTypes.isEmpty() ? QString() : ns_jingle_rtp;
- d->payloadTypes = payloadTypes;
-}
-
void QXmppJingleIq::Content::addTransportCandidate(const QXmppJingleCandidate &candidate)
{
d->transportType = ns_jingle_ice_udp;
@@ -687,9 +705,9 @@ void QXmppJingleIq::Content::parse(const QDomElement &element)
// description
QDomElement descriptionElement = element.firstChildElement(QStringLiteral("description"));
- d->descriptionType = descriptionElement.namespaceURI();
- d->descriptionMedia = descriptionElement.attribute(QStringLiteral("media"));
- d->descriptionSsrc = descriptionElement.attribute(QStringLiteral("ssrc")).toULong();
+ d->description.setType(descriptionElement.namespaceURI());
+ d->description.setMedia(descriptionElement.attribute(QStringLiteral("media")));
+ d->description.setSsrc(descriptionElement.attribute(QStringLiteral("ssrc")).toULong());
d->isRtpMultiplexingSupported = !descriptionElement.firstChildElement(QStringLiteral("rtcp-mux")).isNull();
for (auto childElement = descriptionElement.firstChildElement();
@@ -710,7 +728,7 @@ void QXmppJingleIq::Content::parse(const QDomElement &element)
while (!child.isNull()) {
QXmppJinglePayloadType payload;
payload.parse(child);
- d->payloadTypes << payload;
+ d->description.addPayloadType(payload);
child = child.nextSiblingElement(QStringLiteral("payload-type"));
}
@@ -749,13 +767,13 @@ void QXmppJingleIq::Content::toXml(QXmlStreamWriter *writer) const
helperToXmlAddAttribute(writer, QStringLiteral("senders"), d->senders);
// description
- if (!d->descriptionType.isEmpty() || !d->payloadTypes.isEmpty()) {
+ if (!d->description.type().isEmpty() || !d->description.payloadTypes().isEmpty()) {
writer->writeStartElement(QStringLiteral("description"));
- writer->writeDefaultNamespace(d->descriptionType);
- helperToXmlAddAttribute(writer, QStringLiteral("media"), d->descriptionMedia);
+ writer->writeDefaultNamespace(d->description.type());
+ helperToXmlAddAttribute(writer, QStringLiteral("media"), d->description.media());
- if (d->descriptionSsrc) {
- writer->writeAttribute(QStringLiteral("ssrc"), QString::number(d->descriptionSsrc));
+ if (d->description.ssrc()) {
+ writer->writeAttribute(QStringLiteral("ssrc"), QString::number(d->description.ssrc()));
}
if (d->isRtpMultiplexingSupported) {
@@ -769,7 +787,7 @@ void QXmppJingleIq::Content::toXml(QXmlStreamWriter *writer) const
jingleRtpFeedbackNegotiationElementsToXml(writer, d->rtpFeedbackProperties, d->rtpFeedbackIntervals);
jingleRtpHeaderExtensionsNegotiationElementsToXml(writer, d->rtpHeaderExtensionProperties, d->isRtpHeaderExtensionMixingAllowed);
- for (const auto &payload : d->payloadTypes) {
+ for (const auto &payload : d->description.payloadTypes()) {
payload.toXml(writer);
}
@@ -888,7 +906,7 @@ bool QXmppJingleIq::Content::parseSdp(const QString &sdp)
qWarning() << "Could not parse ssrc" << line;
return false;
}
- d->descriptionSsrc = bits[0].toULong();
+ d->description.setSsrc(bits[0].toULong());
}
} else if (line.startsWith(QStringLiteral("m="))) {
// FIXME: what do we do with the profile (bits[2]) ?
@@ -897,7 +915,7 @@ bool QXmppJingleIq::Content::parseSdp(const QString &sdp)
qWarning() << "Could not parse media" << line;
return false;
}
- d->descriptionMedia = bits[0];
+ d->description.setMedia(bits[0]);
// parse payload types
for (int i = 3; i < bits.size(); ++i) {
@@ -912,7 +930,8 @@ bool QXmppJingleIq::Content::parseSdp(const QString &sdp)
}
}
}
- setPayloadTypes(payloads);
+
+ d->description.setPayloadTypes(payloads);
return true;
}
@@ -945,7 +964,7 @@ QString QXmppJingleIq::Content::toSdp() const
// media
QString payloads;
QStringList attrs;
- for (const QXmppJinglePayloadType &payload : d->payloadTypes) {
+ for (const QXmppJinglePayloadType &payload : d->description.payloadTypes()) {
payloads += " " + QString::number(payload.id());
QString rtpmap = QString::number(payload.id()) + " " + payload.name() + "/" + QString::number(payload.clockrate());
if (payload.channels() > 1) {
@@ -970,7 +989,7 @@ QString QXmppJingleIq::Content::toSdp() const
attrs << QStringLiteral("a=fmtp:") + QByteArray::number(payload.id()) + QStringLiteral(" ") + paramList.join("; ");
}
}
- sdp << QStringLiteral("m=%1 %2 RTP/AVP%3").arg(d->descriptionMedia, QString::number(localRtpPort), payloads);
+ sdp << QStringLiteral("m=%1 %2 RTP/AVP%3").arg(d->description.media(), QString::number(localRtpPort), payloads);
sdp << QStringLiteral("c=%1").arg(addressToSdp(localRtpAddress));
sdp += attrs;
@@ -996,45 +1015,60 @@ QString QXmppJingleIq::Content::toSdp() const
/// \endcond
+class QXmppJingleIqReasonPrivate : public QSharedData
+{
+public:
+ QXmppJingleIqReasonPrivate();
+
+ QString m_text;
+ QXmppJingleReason::Type m_type;
+ QXmppJingleReason::RtpErrorCondition m_rtpErrorCondition;
+};
+
+QXmppJingleIqReasonPrivate::QXmppJingleIqReasonPrivate()
+ : m_type(QXmppJingleReason::Type::None),
+ m_rtpErrorCondition(QXmppJingleReason::RtpErrorCondition::NoErrorCondition)
+{
+}
+
///
-/// \enum QXmppJingleIq::Reason::RtpErrorCondition
-///
-/// Condition of an RTP-specific error
+/// \class QXmppJingleReason
///
-/// \since QXmpp 1.5
+/// The QXmppJingleReason class represents the "reason" element of a
+/// QXmppJingle element.
///
-QXmppJingleIq::Reason::Reason()
- : m_type(None)
+QXmppJingleReason::QXmppJingleReason()
+ : d(new QXmppJingleIqReasonPrivate())
{
}
/// Returns the reason's textual description.
-QString QXmppJingleIq::Reason::text() const
+QString QXmppJingleReason::text() const
{
- return m_text;
+ return d->m_text;
}
/// Sets the reason's textual description.
-void QXmppJingleIq::Reason::setText(const QString &text)
+void QXmppJingleReason::setText(const QString &text)
{
- m_text = text;
+ d->m_text = text;
}
/// Gets the reason's type.
-QXmppJingleIq::Reason::Type QXmppJingleIq::Reason::type() const
+QXmppJingleReason::Type QXmppJingleReason::type() const
{
- return m_type;
+ return d->m_type;
}
/// Sets the reason's type.
-void QXmppJingleIq::Reason::setType(QXmppJingleIq::Reason::Type type)
+void QXmppJingleReason::setType(QXmppJingleReason::Type type)
{
- m_type = type;
+ d->m_type = type;
}
///
@@ -1044,9 +1078,9 @@ void QXmppJingleIq::Reason::setType(QXmppJingleIq::Reason::Type type)
///
/// \since QXmpp 1.5
///
-QXmppJingleIq::Reason::RtpErrorCondition QXmppJingleIq::Reason::rtpErrorCondition() const
+QXmppJingleReason::RtpErrorCondition QXmppJingleReason::rtpErrorCondition() const
{
- return m_rtpErrorCondition;
+ return d->m_rtpErrorCondition;
}
///
@@ -1056,18 +1090,18 @@ QXmppJingleIq::Reason::RtpErrorCondition QXmppJingleIq::Reason::rtpErrorConditio
///
/// \since QXmpp 1.5
///
-void QXmppJingleIq::Reason::setRtpErrorCondition(RtpErrorCondition rtpErrorCondition)
+void QXmppJingleReason::setRtpErrorCondition(RtpErrorCondition rtpErrorCondition)
{
- m_rtpErrorCondition = rtpErrorCondition;
+ d->m_rtpErrorCondition = rtpErrorCondition;
}
/// \cond
-void QXmppJingleIq::Reason::parse(const QDomElement &element)
+void QXmppJingleReason::parse(const QDomElement &element)
{
- m_text = element.firstChildElement(QStringLiteral("text")).text();
+ d->m_text = element.firstChildElement(QStringLiteral("text")).text();
for (int i = AlternativeSession; i <= UnsupportedTransports; i++) {
if (!element.firstChildElement(jingle_reasons[i]).isNull()) {
- m_type = static_cast<Type>(i);
+ d->m_type = static_cast<Type>(i);
break;
}
}
@@ -1078,27 +1112,29 @@ void QXmppJingleIq::Reason::parse(const QDomElement &element)
if (child.namespaceURI() == ns_jingle_rtp_errors) {
if (const auto index = JINGLE_RTP_ERROR_CONDITIONS.indexOf(child.tagName());
index != -1) {
- m_rtpErrorCondition = RtpErrorCondition(index);
+ d->m_rtpErrorCondition = RtpErrorCondition(index);
}
break;
}
}
}
-void QXmppJingleIq::Reason::toXml(QXmlStreamWriter *writer) const
+void QXmppJingleReason::toXml(QXmlStreamWriter *writer) const
{
- if (m_type < AlternativeSession || m_type > UnsupportedTransports) {
+ if (d->m_type < AlternativeSession || d->m_type > UnsupportedTransports) {
return;
}
writer->writeStartElement(QStringLiteral("reason"));
- if (!m_text.isEmpty()) {
- helperToXmlAddTextElement(writer, QStringLiteral("text"), m_text);
+ writer->writeDefaultNamespace(ns_jingle);
+
+ if (!d->m_text.isEmpty()) {
+ helperToXmlAddTextElement(writer, QStringLiteral("text"), d->m_text);
}
- writer->writeEmptyElement(jingle_reasons[m_type]);
+ writer->writeEmptyElement(jingle_reasons[d->m_type]);
- if (m_rtpErrorCondition != NoErrorCondition) {
- writer->writeStartElement(JINGLE_RTP_ERROR_CONDITIONS.at(m_rtpErrorCondition));
+ if (d->m_rtpErrorCondition != NoErrorCondition) {
+ writer->writeStartElement(JINGLE_RTP_ERROR_CONDITIONS.at(d->m_rtpErrorCondition));
writer->writeDefaultNamespace(ns_jingle_rtp_errors);
writer->writeEndElement();
}
@@ -1120,7 +1156,7 @@ public:
QString mujiGroupChatJid;
QList<QXmppJingleIq::Content> contents;
- QXmppJingleIq::Reason reason;
+ QXmppJingleReason reason;
std::optional<QXmppJingleIq::RtpSessionState> rtpSessionState;
};
@@ -1213,14 +1249,14 @@ void QXmppJingleIq::setInitiator(const QString &initiator)
/// Returns a reference to the IQ's reason element.
-QXmppJingleIq::Reason &QXmppJingleIq::reason()
+QXmppJingleReason &QXmppJingleIq::reason()
{
return d->reason;
}
/// Returns a const reference to the IQ's reason element.
-const QXmppJingleIq::Reason &QXmppJingleIq::reason() const
+const QXmppJingleReason &QXmppJingleIq::reason() const
{
return d->reason;
}
@@ -1378,6 +1414,7 @@ void QXmppJingleIq::parseElementFromChild(const QDomElement &element)
addContent(content);
contentElement = contentElement.nextSiblingElement(QStringLiteral("content"));
}
+
QDomElement reasonElement = jingleElement.firstChildElement(QStringLiteral("reason"));
d->reason.parse(reasonElement);
@@ -2056,6 +2093,142 @@ bool QXmppJinglePayloadType::operator==(const QXmppJinglePayloadType &other) con
}
}
+class QXmppJingleDescriptionPrivate : public QSharedData
+{
+public:
+ QXmppJingleDescriptionPrivate() = default;
+
+ QString media;
+ quint32 ssrc;
+ QString type;
+ QList<QXmppJinglePayloadType> payloadTypes;
+};
+
+///
+/// \class QXmppJingleDescription
+///
+/// \brief The QXmppJingleDescription class represents descriptions for Jingle elements including
+/// media type, streaming source, namespace and payload types.
+///
+/// \since QXmpp 1.6
+///
+
+QXmppJingleDescription::QXmppJingleDescription()
+ : d(new QXmppJingleDescriptionPrivate())
+{
+}
+
+QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(QXmppJingleDescription)
+
+///
+/// Returns the media type.
+///
+QString QXmppJingleDescription::media() const
+{
+ return d->media;
+}
+
+///
+/// Sets the media type.
+///
+void QXmppJingleDescription::setMedia(const QString &media)
+{
+ d->media = media;
+}
+
+///
+/// Returns the streaming source.
+///
+quint32 QXmppJingleDescription::ssrc() const
+{
+ return d->ssrc;
+}
+
+///
+/// Sets the streaming source.
+///
+void QXmppJingleDescription::setSsrc(quint32 ssrc)
+{
+ d->ssrc = ssrc;
+}
+
+///
+/// Returns the description namespace.
+///
+QString QXmppJingleDescription::type() const
+{
+ return d->type;
+}
+
+///
+/// Sets the description namespace.
+///
+void QXmppJingleDescription::setType(const QString &type)
+{
+ d->type = type;
+}
+
+///
+/// Adds a payload type to the list of payload types.
+///
+void QXmppJingleDescription::addPayloadType(const QXmppJinglePayloadType &payload)
+{
+ d->type = ns_jingle_rtp;
+ d->payloadTypes.append(payload);
+}
+
+///
+/// Returns a list of payload types.
+///
+const QList<QXmppJinglePayloadType> &QXmppJingleDescription::payloadTypes() const
+{
+ return d->payloadTypes;
+}
+
+///
+/// Sets the list of payload types.
+///
+void QXmppJingleDescription::setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes)
+{
+ d->type = payloadTypes.isEmpty() ? QString() : ns_jingle_rtp;
+ d->payloadTypes = payloadTypes;
+}
+
+/// \cond
+void QXmppJingleDescription::parse(const QDomElement &element)
+{
+ d->type = element.namespaceURI();
+ d->media = element.attribute(QStringLiteral("media"));
+ d->ssrc = element.attribute(QStringLiteral("ssrc")).toULong();
+
+ QDomElement child { element.firstChildElement(QStringLiteral("payload-type")) };
+ while (!child.isNull()) {
+ QXmppJinglePayloadType payload;
+ payload.parse(child);
+ d->payloadTypes.append(payload);
+ child = child.nextSiblingElement(QStringLiteral("payload-type"));
+ }
+}
+
+void QXmppJingleDescription::toXml(QXmlStreamWriter *writer) const
+{
+ writer->writeStartElement(QStringLiteral("description"));
+ writer->writeDefaultNamespace(d->type);
+
+ helperToXmlAddAttribute(writer, QStringLiteral("media"), d->media);
+
+ if (d->ssrc) {
+ writer->writeAttribute(QStringLiteral("ssrc"), QString::number(d->ssrc));
+ }
+
+ for (const auto &payloadType : d->payloadTypes) {
+ payloadType.toXml(writer);
+ }
+
+ writer->writeEndElement();
+}
+/// \endcond
+
class QXmppSdpParameterPrivate : public QSharedData
{
public:
@@ -2779,3 +2952,275 @@ bool QXmppJingleRtpHeaderExtensionProperty::isJingleRtpHeaderExtensionProperty(c
return element.tagName() == QStringLiteral("rtp-hdrext") &&
element.namespaceURI() == ns_jingle_rtp_header_extensions_negotiation;
}
+
+class QXmppJingleMessageInitiationElementPrivate : public QSharedData
+{
+public:
+ QXmppJingleMessageInitiationElementPrivate() = default;
+
+ QXmppJingleMessageInitiationElement::Type type { QXmppJingleMessageInitiationElement::Type::None };
+ QString id;
+
+ std::optional<QXmppJingleDescription> description;
+ std::optional<QXmppJingleReason> reason;
+ QString migratedTo;
+
+ bool containsTieBreak;
+};
+
+QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(QXmppJingleReason)
+
+///
+/// \enum QXmppJingleMessageInitiationElement::Type
+///
+/// Possible types of Jingle Message Initiation elements
+///
+
+///
+/// \class QXmppJingleMessageInitiationElement
+///
+/// \brief The QXmppJingleMessageInitiationElement class represents a Jingle Message Initiation
+/// element as specified by \xep{0353}: Jingle Message Initiation.
+///
+/// \ingroup Stanzas
+///
+/// \since QXmpp 1.6
+///
+
+///
+/// \brief Constructs a Jingle Message Initiation element.
+/// \param type The JMI element type
+///
+QXmppJingleMessageInitiationElement::QXmppJingleMessageInitiationElement()
+ : d(new QXmppJingleMessageInitiationElementPrivate())
+{
+}
+
+///
+/// Returns the Jingle Message Initiation element type
+///
+QXmppJingleMessageInitiationElement::Type QXmppJingleMessageInitiationElement::type() const
+{
+ return d->type;
+}
+
+///
+/// Sets the Jingle Message Initiation element type.
+///
+void QXmppJingleMessageInitiationElement::setType(Type type)
+{
+ d->type = type;
+}
+
+///
+/// Returns the Jingle Message Initiation element id.
+///
+QString QXmppJingleMessageInitiationElement::id() const
+{
+ return d->id;
+}
+
+///
+/// Sets the Jingle Message Initiation element id.
+///
+void QXmppJingleMessageInitiationElement::setId(const QString &id)
+{
+ d->id = id;
+}
+
+///
+/// Returns the Jingle Message Initiation element description.
+///
+std::optional<QXmppJingleDescription> QXmppJingleMessageInitiationElement::description() const
+{
+ return d->description;
+}
+
+///
+/// Sets the Jingle Message Initiation element description.
+///
+void QXmppJingleMessageInitiationElement::setDescription(std::optional<QXmppJingleDescription> description)
+{
+ d->description = description;
+}
+
+///
+/// Returns the Jingle Message Initiation element reason.
+///
+std::optional<QXmppJingleReason> QXmppJingleMessageInitiationElement::reason() const
+{
+ return d->reason;
+}
+
+///
+/// Sets the Jingle Message Initiation element reason.
+///
+void QXmppJingleMessageInitiationElement::setReason(std::optional<QXmppJingleReason> reason)
+{
+ d->reason = reason;
+}
+
+///
+/// Returns true if the Jingle Message Initiation element contains a <tie-break/> tag.
+///
+bool QXmppJingleMessageInitiationElement::containsTieBreak() const
+{
+ return d->containsTieBreak;
+}
+
+///
+/// Sets if the Jingle Message Initiation element contains a <tie-break/> tag.
+///
+void QXmppJingleMessageInitiationElement::setContainsTieBreak(bool containsTieBreak)
+{
+ d->containsTieBreak = containsTieBreak;
+}
+
+///
+/// Returns the Jingle Message Initiation element ID migrated to if the Jingle is being migrated
+/// to a different device.
+///
+QString QXmppJingleMessageInitiationElement::migratedTo() const
+{
+ return d->migratedTo;
+}
+
+///
+/// Sets the Jingle Message Initiation element ID migrated to if the Jingle is being migrated
+/// to a different device.
+///
+void QXmppJingleMessageInitiationElement::setMigratedTo(const QString &migratedTo)
+{
+ d->migratedTo = migratedTo;
+}
+
+/// \cond
+void QXmppJingleMessageInitiationElement::parse(const QDomElement &element)
+{
+ std::optional<Type> type { stringToJmiElementType(element.nodeName()) };
+
+ if (!type.has_value()) {
+ return;
+ }
+
+ d->type = type.value();
+ d->id = element.attribute(QStringLiteral("id"));
+
+ // Type::Proceed and Type::Ringing don't need any parsing aside of the id.
+ switch (d->type) {
+ case Type::Propose: {
+ if (const auto &descriptionElement = element.firstChildElement("description"); !descriptionElement.isNull()) {
+ d->description = QXmppJingleDescription();
+ d->description->parse(descriptionElement);
+ }
+
+ break;
+ }
+ case Type::Reject:
+ case Type::Retract:
+ d->containsTieBreak = !element.firstChildElement("tie-break").isNull();
+
+ if (const auto &reasonElement = element.firstChildElement("reason"); !reasonElement.isNull()) {
+ d->reason = QXmppJingleReason();
+ d->reason->parse(reasonElement);
+ }
+
+ break;
+ case Type::Finish:
+ if (auto reasonElement = element.firstChildElement("reason"); !reasonElement.isNull()) {
+ d->reason = QXmppJingleReason();
+ d->reason->parse(reasonElement);
+ }
+
+ if (auto migratedToElement = element.firstChildElement("migrated"); !migratedToElement.isNull()) {
+ d->migratedTo = migratedToElement.attribute("to");
+ }
+
+ break;
+ default:
+ break;
+ }
+}
+
+void QXmppJingleMessageInitiationElement::toXml(QXmlStreamWriter *writer) const
+{
+ writer->writeStartElement(jmiElementTypeToString(d->type));
+ writer->writeDefaultNamespace(ns_jingle_message_initiation);
+
+ helperToXmlAddAttribute(writer, QStringLiteral("id"), d->id);
+
+ if (d->description) {
+ d->description->toXml(writer);
+ }
+
+ if (d->reason) {
+ d->reason->toXml(writer);
+ }
+
+ if (d->containsTieBreak) {
+ writer->writeEmptyElement(QStringLiteral("tie-break"));
+ }
+
+ if (!d->migratedTo.isEmpty()) {
+ writer->writeEmptyElement(QStringLiteral("migrated"));
+ helperToXmlAddAttribute(writer, QStringLiteral("to"), d->migratedTo);
+ }
+
+ writer->writeEndElement();
+}
+/// \endcond
+
+QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(QXmppJingleMessageInitiationElement)
+
+///
+/// Returns true if passed QDomElement is a Jingle Message Initiation element
+///
+bool QXmppJingleMessageInitiationElement::isJingleMessageInitiationElement(const QDomElement &element)
+{
+ return stringToJmiElementType(element.tagName()).has_value() && element.hasAttribute(QStringLiteral("id")) && element.namespaceURI() == ns_jingle_message_initiation;
+}
+
+///
+/// Takes a Jingle Message Initiation element type and parses it to a string.
+///
+QString QXmppJingleMessageInitiationElement::jmiElementTypeToString(Type type)
+{
+ switch (type) {
+ case Type::Propose:
+ return "propose";
+ case Type::Ringing:
+ return "ringing";
+ case Type::Proceed:
+ return "proceed";
+ case Type::Reject:
+ return "reject";
+ case Type::Retract:
+ return "retract";
+ case Type::Finish:
+ return "finish";
+ default:
+ return {};
+ }
+}
+
+///
+/// Takes a string and parses it to a Jingle Message Initiation element type.
+///
+std::optional<QXmppJingleMessageInitiationElement::Type> QXmppJingleMessageInitiationElement::stringToJmiElementType(const QString &typeStr)
+{
+ if (typeStr == "propose") {
+ return Type::Propose;
+ } else if (typeStr == "ringing") {
+ return Type::Ringing;
+ } else if (typeStr == "proceed") {
+ return Type::Proceed;
+ } else if (typeStr == "reject") {
+ return Type::Reject;
+ } else if (typeStr == "retract") {
+ return Type::Retract;
+ } else if (typeStr == "finish") {
+ return Type::Finish;
+ }
+
+ return std::nullopt;
+}
diff --git a/src/base/QXmppJingleData.h b/src/base/QXmppJingleData.h
new file mode 100644
index 00000000..e36577be
--- /dev/null
+++ b/src/base/QXmppJingleData.h
@@ -0,0 +1,662 @@
+// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
+// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
+// SPDX-FileCopyrightText: 2023 Tibor Csötönyi <work@taibsu.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef QXMPPJINGLEIQ_H
+#define QXMPPJINGLEIQ_H
+
+#include "QXmppIq.h"
+
+#include <variant>
+
+#include <QHostAddress>
+
+class QXmppJingleCandidatePrivate;
+class QXmppJingleDescriptionPrivate;
+class QXmppJingleIqContentPrivate;
+class QXmppJingleIqReasonPrivate;
+class QXmppJingleIqPrivate;
+class QXmppJinglePayloadTypePrivate;
+class QXmppJingleRtpCryptoElementPrivate;
+class QXmppJingleRtpEncryptionPrivate;
+class QXmppJingleRtpFeedbackPropertyPrivate;
+class QXmppJingleRtpHeaderExtensionPropertyPrivate;
+class QXmppSdpParameterPrivate;
+class QXmppJingleMessageInitiationElementPrivate;
+
+class QXMPP_EXPORT QXmppSdpParameter
+{
+public:
+ QXmppSdpParameter();
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppSdpParameter)
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QString value() const;
+ void setValue(const QString &value);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isSdpParameter(const QDomElement &element);
+
+private:
+ QSharedDataPointer<QXmppSdpParameterPrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleRtpCryptoElement
+{
+public:
+ QXmppJingleRtpCryptoElement();
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpCryptoElement)
+
+ uint32_t tag() const;
+ void setTag(uint32_t tag);
+
+ QString cryptoSuite() const;
+ void setCryptoSuite(const QString &cryptoSuite);
+
+ QString keyParams() const;
+ void setKeyParams(const QString &keyParams);
+
+ QString sessionParams() const;
+ void setSessionParams(const QString &sessionParams);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isJingleRtpCryptoElement(const QDomElement &element);
+
+private:
+ QSharedDataPointer<QXmppJingleRtpCryptoElementPrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleRtpEncryption
+{
+public:
+ QXmppJingleRtpEncryption();
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpEncryption)
+
+ bool isRequired() const;
+ void setRequired(bool isRequired);
+
+ QVector<QXmppJingleRtpCryptoElement> cryptoElements() const;
+ void setCryptoElements(const QVector<QXmppJingleRtpCryptoElement> &cryptoElements);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isJingleRtpEncryption(const QDomElement &element);
+
+private:
+ QSharedDataPointer<QXmppJingleRtpEncryptionPrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleRtpFeedbackProperty
+{
+public:
+ QXmppJingleRtpFeedbackProperty();
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpFeedbackProperty)
+
+ QString type() const;
+ void setType(const QString &type);
+
+ QString subtype() const;
+ void setSubtype(const QString &subtype);
+
+ QVector<QXmppSdpParameter> parameters() const;
+ void setParameters(const QVector<QXmppSdpParameter> &parameters);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isJingleRtpFeedbackProperty(const QDomElement &element);
+
+private:
+ QSharedDataPointer<QXmppJingleRtpFeedbackPropertyPrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleRtpFeedbackInterval
+{
+public:
+ QXmppJingleRtpFeedbackInterval();
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpFeedbackInterval)
+
+ uint64_t value() const;
+ void setValue(uint64_t value);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isJingleRtpFeedbackInterval(const QDomElement &element);
+
+private:
+ uint64_t m_value;
+};
+
+class QXMPP_EXPORT QXmppJingleRtpHeaderExtensionProperty
+{
+public:
+ enum Senders {
+ /// The initiator and the sender are allowed.
+ Both,
+ /// Only the initiator is allowed.
+ Initiator,
+ /// Only the responder is allowed.
+ Responder
+ };
+
+ QXmppJingleRtpHeaderExtensionProperty();
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpHeaderExtensionProperty)
+
+ uint32_t id() const;
+ void setId(uint32_t id);
+
+ QString uri() const;
+ void setUri(const QString &uri);
+
+ Senders senders() const;
+ void setSenders(Senders senders);
+
+ QVector<QXmppSdpParameter> parameters() const;
+ void setParameters(const QVector<QXmppSdpParameter> &parameters);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isJingleRtpHeaderExtensionProperty(const QDomElement &element);
+
+private:
+ QSharedDataPointer<QXmppJingleRtpHeaderExtensionPropertyPrivate> d;
+};
+
+///
+/// \brief The QXmppJinglePayloadType class represents a payload type
+/// as specified by \xep{0167}: Jingle RTP Sessions and RFC 5245.
+///
+class QXMPP_EXPORT QXmppJinglePayloadType
+{
+public:
+ QXmppJinglePayloadType();
+ QXmppJinglePayloadType(const QXmppJinglePayloadType &other);
+ ~QXmppJinglePayloadType();
+
+ unsigned char channels() const;
+ void setChannels(unsigned char channels);
+
+ unsigned int clockrate() const;
+ void setClockrate(unsigned int clockrate);
+
+ unsigned char id() const;
+ void setId(unsigned char id);
+
+ unsigned int maxptime() const;
+ void setMaxptime(unsigned int maxptime);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QMap<QString, QString> parameters() const;
+ void setParameters(const QMap<QString, QString> &parameters);
+
+ unsigned int ptime() const;
+ void setPtime(unsigned int ptime);
+
+ QVector<QXmppJingleRtpFeedbackProperty> rtpFeedbackProperties() const;
+ void setRtpFeedbackProperties(const QVector<QXmppJingleRtpFeedbackProperty> &rtpFeedbackProperties);
+
+ QVector<QXmppJingleRtpFeedbackInterval> rtpFeedbackIntervals() const;
+ void setRtpFeedbackIntervals(const QVector<QXmppJingleRtpFeedbackInterval> &rtpFeedbackIntervals);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ QXmppJinglePayloadType &operator=(const QXmppJinglePayloadType &other);
+ bool operator==(const QXmppJinglePayloadType &other) const;
+
+private:
+ QSharedDataPointer<QXmppJinglePayloadTypePrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleDescription
+{
+public:
+ QXmppJingleDescription();
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleDescription)
+
+ QString media() const;
+ void setMedia(const QString &media);
+
+ quint32 ssrc() const;
+ void setSsrc(quint32 ssrc);
+
+ QString type() const;
+ void setType(const QString &type);
+
+ void addPayloadType(const QXmppJinglePayloadType &payload);
+ const QList<QXmppJinglePayloadType> &payloadTypes() const;
+ void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+private:
+ QSharedDataPointer<QXmppJingleDescriptionPrivate> d;
+};
+
+///
+/// \brief The QXmppJingleCandidate class represents a transport candidate
+/// as specified by \xep{0176}: Jingle ICE-UDP Transport Method.
+///
+class QXMPP_EXPORT QXmppJingleCandidate
+{
+public:
+ /// This enum is used to describe a candidate's type.
+ enum Type {
+ HostType, ///< Host candidate, a local address/port.
+ PeerReflexiveType, ///< Peer-reflexive candidate,
+ ///< the address/port as seen from the peer.
+ ServerReflexiveType, ///< Server-reflexive candidate,
+ ///< the address/port as seen by the STUN server
+ RelayedType ///< Relayed candidate, a candidate from
+ ///< a TURN relay.
+ };
+
+ QXmppJingleCandidate();
+ QXmppJingleCandidate(const QXmppJingleCandidate &other);
+ QXmppJingleCandidate(QXmppJingleCandidate &&);
+ ~QXmppJingleCandidate();
+
+ QXmppJingleCandidate &operator=(const QXmppJingleCandidate &other);
+ QXmppJingleCandidate &operator=(QXmppJingleCandidate &&);
+
+ int component() const;
+ void setComponent(int component);
+
+ QString foundation() const;
+ void setFoundation(const QString &foundation);
+
+ int generation() const;
+ void setGeneration(int generation);
+
+ QHostAddress host() const;
+ void setHost(const QHostAddress &host);
+
+ QString id() const;
+ void setId(const QString &id);
+
+ int network() const;
+ void setNetwork(int network);
+
+ quint16 port() const;
+ void setPort(quint16 port);
+
+ int priority() const;
+ void setPriority(int priority);
+
+ QString protocol() const;
+ void setProtocol(const QString &protocol);
+
+ QXmppJingleCandidate::Type type() const;
+ void setType(QXmppJingleCandidate::Type);
+
+ bool isNull() const;
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+
+ static QXmppJingleCandidate::Type typeFromString(const QString &typeStr, bool *ok = nullptr);
+ static QString typeToString(QXmppJingleCandidate::Type type);
+ /// \endcond
+
+private:
+ QSharedDataPointer<QXmppJingleCandidatePrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleReason
+{
+public:
+ /// This enum is used to describe a reason's type.
+ enum Type {
+ None,
+ AlternativeSession,
+ Busy,
+ Cancel,
+ ConnectivityError,
+ Decline,
+ Expired,
+ FailedApplication,
+ FailedTransport,
+ GeneralError,
+ Gone,
+ IncompatibleParameters,
+ MediaError,
+ SecurityError,
+ Success,
+ Timeout,
+ UnsupportedApplications,
+ UnsupportedTransports
+ };
+
+ /// Condition of an RTP-specific error
+ /// \since QXmpp 1.5
+ enum RtpErrorCondition {
+ /// There is no error condition.
+ NoErrorCondition,
+ /// The encryption offer is rejected.
+ InvalidCrypto,
+ /// Encryption is required but not offered.
+ CryptoRequired
+ };
+
+ QXmppJingleReason();
+
+ QString text() const;
+ void setText(const QString &text);
+
+ Type type() const;
+ void setType(Type type);
+
+ RtpErrorCondition rtpErrorCondition() const;
+ void setRtpErrorCondition(RtpErrorCondition rtpErrorCondition);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+
+ /// \endcond
+
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleReason)
+
+private:
+ QSharedDataPointer<QXmppJingleIqReasonPrivate> d;
+};
+
+///
+/// \brief The QXmppJingleIq class represents an IQ used for initiating media
+/// sessions as specified by \xep{0166}: Jingle.
+///
+/// \ingroup Stanzas
+///
+class QXMPP_EXPORT QXmppJingleIq : public QXmppIq
+{
+public:
+ /// This enum is used to describe a Jingle action.
+ enum Action {
+ ContentAccept,
+ ContentAdd,
+ ContentModify,
+ ContentReject,
+ ContentRemove,
+ DescriptionInfo,
+ SecurityInfo,
+ SessionAccept,
+ SessionInfo,
+ SessionInitiate,
+ SessionTerminate,
+ TransportAccept,
+ TransportInfo,
+ TransportReject,
+ TransportReplace
+ };
+
+ enum Creator {
+ /// The initiator generated the content type.
+ Initiator,
+ /// The responder generated the content type.
+ Responder
+ };
+
+ struct RtpSessionStateActive
+ {
+ };
+
+ struct RtpSessionStateHold
+ {
+ };
+
+ struct RtpSessionStateUnhold
+ {
+ };
+
+ struct RtpSessionStateMuting
+ {
+ /// True when temporarily not sending media to the other party but continuing to accept
+ /// media from it, false for ending mute state
+ bool isMute = true;
+ /// Creator of the corresponding session
+ Creator creator;
+ /// Session to be muted (e.g., only audio or video)
+ QString name;
+ };
+
+ struct RtpSessionStateRinging
+ {
+ };
+
+ using RtpSessionState = std::variant<RtpSessionStateActive, RtpSessionStateHold, RtpSessionStateUnhold, RtpSessionStateMuting, RtpSessionStateRinging>;
+
+ /// Alias to QXmppJingleReason for compatibility.
+ using Reason = QXmppJingleReason;
+
+ /// \internal
+ ///
+ /// The QXmppJingleIq::Content class represents the "content" element of a
+ /// QXmppJingleIq.
+ ///
+ class QXMPP_EXPORT Content
+ {
+ public:
+ Content();
+ Content(const QXmppJingleIq::Content &other);
+ Content(QXmppJingleIq::Content &&);
+ ~Content();
+
+ Content &operator=(const Content &other);
+ Content &operator=(Content &&);
+
+ QString creator() const;
+ void setCreator(const QString &creator);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QString senders() const;
+ void setSenders(const QString &senders);
+
+ // XEP-0167: Jingle RTP Sessions
+ QXmppJingleDescription description() const;
+ void setDescription(const QXmppJingleDescription &description);
+
+#if QXMPP_DEPRECATED_SINCE(1, 6)
+ QString descriptionMedia() const;
+ void setDescriptionMedia(const QString &media);
+
+ quint32 descriptionSsrc() const;
+ void setDescriptionSsrc(quint32 ssrc);
+
+ void addPayloadType(const QXmppJinglePayloadType &payload);
+ QList<QXmppJinglePayloadType> payloadTypes() const;
+ void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
+#endif
+
+ bool isRtpMultiplexingSupported() const;
+ void setRtpMultiplexingSupported(bool isRtpMultiplexingSupported);
+
+ std::optional<QXmppJingleRtpEncryption> rtpEncryption() const;
+ void setRtpEncryption(const std::optional<QXmppJingleRtpEncryption> &rtpEncryption);
+
+ void addTransportCandidate(const QXmppJingleCandidate &candidate);
+ QList<QXmppJingleCandidate> transportCandidates() const;
+ void setTransportCandidates(const QList<QXmppJingleCandidate> &candidates);
+
+ QString transportUser() const;
+ void setTransportUser(const QString &user);
+
+ QString transportPassword() const;
+ void setTransportPassword(const QString &password);
+
+ QVector<QXmppJingleRtpFeedbackProperty> rtpFeedbackProperties() const;
+ void setRtpFeedbackProperties(const QVector<QXmppJingleRtpFeedbackProperty> &rtpFeedbackProperties);
+
+ QVector<QXmppJingleRtpFeedbackInterval> rtpFeedbackIntervals() const;
+ void setRtpFeedbackIntervals(const QVector<QXmppJingleRtpFeedbackInterval> &rtpFeedbackIntervals);
+
+ QVector<QXmppJingleRtpHeaderExtensionProperty> rtpHeaderExtensionProperties() const;
+ void setRtpHeaderExtensionProperties(const QVector<QXmppJingleRtpHeaderExtensionProperty> &rtpHeaderExtensionProperties);
+
+ bool isRtpHeaderExtensionMixingAllowed() const;
+ void setRtpHeaderExtensionMixingAllowed(bool isRtpHeaderExtensionMixingAllowed);
+
+ // XEP-0320: Use of DTLS-SRTP in Jingle Sessions
+ QByteArray transportFingerprint() const;
+ void setTransportFingerprint(const QByteArray &fingerprint);
+
+ QString transportFingerprintHash() const;
+ void setTransportFingerprintHash(const QString &hash);
+
+ QString transportFingerprintSetup() const;
+ void setTransportFingerprintSetup(const QString &setup);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+
+ bool parseSdp(const QString &sdp);
+ QString toSdp() const;
+ /// \endcond
+
+ private:
+ QSharedDataPointer<QXmppJingleIqContentPrivate> d;
+ };
+
+ QXmppJingleIq();
+ QXmppJingleIq(const QXmppJingleIq &other);
+ QXmppJingleIq(QXmppJingleIq &&);
+ ~QXmppJingleIq() override;
+
+ QXmppJingleIq &operator=(const QXmppJingleIq &other);
+ QXmppJingleIq &operator=(QXmppJingleIq &&);
+
+ Action action() const;
+ void setAction(Action action);
+
+ void addContent(const Content &content);
+ QList<Content> contents() const;
+ void setContents(const QList<Content> &contents);
+
+ QString initiator() const;
+ void setInitiator(const QString &initiator);
+
+ QXmppJingleReason &reason();
+ const QXmppJingleReason &reason() const;
+
+ QString responder() const;
+ void setResponder(const QString &responder);
+
+#if QXMPP_DEPRECATED_SINCE(1, 5)
+ QT_DEPRECATED_X("Use QXmpp::rtpSessionState() instead")
+ bool ringing() const;
+ QT_DEPRECATED_X("Use QXmpp::setRtpSessionState() instead")
+ void setRinging(bool ringing);
+#endif
+
+ QString sid() const;
+ void setSid(const QString &sid);
+
+ QString mujiGroupChatJid() const;
+ void setMujiGroupChatJid(const QString &mujiGroupChatJid);
+
+ std::optional<RtpSessionState> rtpSessionState() const;
+ void setRtpSessionState(const std::optional<RtpSessionState> &rtpSessionState);
+
+ /// \cond
+ static bool isJingleIq(const QDomElement &element);
+ /// \endcond
+
+protected:
+ /// \cond
+ void parseElementFromChild(const QDomElement &element) override;
+ void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
+ /// \endcond
+
+private:
+ QSharedDataPointer<QXmppJingleIqPrivate> d;
+};
+
+class QXMPP_EXPORT QXmppJingleMessageInitiationElement
+{
+public:
+ enum class Type {
+ None,
+ Propose,
+ Ringing,
+ Proceed,
+ Reject,
+ Retract,
+ Finish
+ };
+
+ QXmppJingleMessageInitiationElement();
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleMessageInitiationElement)
+
+ Type type() const;
+ void setType(Type type);
+
+ QString id() const;
+ void setId(const QString &id);
+
+ std::optional<QXmppJingleDescription> description() const;
+ void setDescription(std::optional<QXmppJingleDescription> description);
+
+ std::optional<QXmppJingleReason> reason() const;
+ void setReason(std::optional<QXmppJingleReason> reason);
+
+ bool containsTieBreak() const;
+ void setContainsTieBreak(bool containsTieBreak);
+
+ QString migratedTo() const;
+ void setMigratedTo(const QString &migratedTo);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+ static bool isJingleMessageInitiationElement(const QDomElement &);
+ static QString jmiElementTypeToString(Type type);
+ static std::optional<Type> stringToJmiElementType(const QString &typeStr);
+
+private:
+ QSharedDataPointer<QXmppJingleMessageInitiationElementPrivate> d;
+};
+
+Q_DECLARE_METATYPE(QXmppJingleReason::RtpErrorCondition)
+
+#endif
diff --git a/src/base/QXmppJingleIq.h b/src/base/QXmppJingleIq.h
index f5da136c..358f7d0b 100644
--- a/src/base/QXmppJingleIq.h
+++ b/src/base/QXmppJingleIq.h
@@ -1,577 +1,5 @@
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
-// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
-#ifndef QXMPPJINGLEIQ_H
-#define QXMPPJINGLEIQ_H
-
-#include "QXmppIq.h"
-
-#include <variant>
-
-#include <QHostAddress>
-
-class QXmppJingleCandidatePrivate;
-class QXmppJingleIqContentPrivate;
-class QXmppJingleIqPrivate;
-class QXmppJinglePayloadTypePrivate;
-class QXmppJingleRtpCryptoElementPrivate;
-class QXmppJingleRtpEncryptionPrivate;
-class QXmppJingleRtpFeedbackPropertyPrivate;
-class QXmppJingleRtpHeaderExtensionPropertyPrivate;
-class QXmppSdpParameterPrivate;
-
-class QXMPP_EXPORT QXmppSdpParameter
-{
-public:
- QXmppSdpParameter();
-
- QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppSdpParameter)
-
- QString name() const;
- void setName(const QString &name);
-
- QString value() const;
- void setValue(const QString &value);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- static bool isSdpParameter(const QDomElement &element);
-
-private:
- QSharedDataPointer<QXmppSdpParameterPrivate> d;
-};
-
-class QXMPP_EXPORT QXmppJingleRtpCryptoElement
-{
-public:
- QXmppJingleRtpCryptoElement();
-
- QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpCryptoElement)
-
- uint32_t tag() const;
- void setTag(uint32_t tag);
-
- QString cryptoSuite() const;
- void setCryptoSuite(const QString &cryptoSuite);
-
- QString keyParams() const;
- void setKeyParams(const QString &keyParams);
-
- QString sessionParams() const;
- void setSessionParams(const QString &sessionParams);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- static bool isJingleRtpCryptoElement(const QDomElement &element);
-
-private:
- QSharedDataPointer<QXmppJingleRtpCryptoElementPrivate> d;
-};
-
-class QXMPP_EXPORT QXmppJingleRtpEncryption
-{
-public:
- QXmppJingleRtpEncryption();
-
- QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpEncryption)
-
- bool isRequired() const;
- void setRequired(bool isRequired);
-
- QVector<QXmppJingleRtpCryptoElement> cryptoElements() const;
- void setCryptoElements(const QVector<QXmppJingleRtpCryptoElement> &cryptoElements);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- static bool isJingleRtpEncryption(const QDomElement &element);
-
-private:
- QSharedDataPointer<QXmppJingleRtpEncryptionPrivate> d;
-};
-
-class QXMPP_EXPORT QXmppJingleRtpFeedbackProperty
-{
-public:
- QXmppJingleRtpFeedbackProperty();
-
- QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpFeedbackProperty)
-
- QString type() const;
- void setType(const QString &type);
-
- QString subtype() const;
- void setSubtype(const QString &subtype);
-
- QVector<QXmppSdpParameter> parameters() const;
- void setParameters(const QVector<QXmppSdpParameter> &parameters);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- static bool isJingleRtpFeedbackProperty(const QDomElement &element);
-
-private:
- QSharedDataPointer<QXmppJingleRtpFeedbackPropertyPrivate> d;
-};
-
-class QXMPP_EXPORT QXmppJingleRtpFeedbackInterval
-{
-public:
- QXmppJingleRtpFeedbackInterval();
-
- QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpFeedbackInterval)
-
- uint64_t value() const;
- void setValue(uint64_t value);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- static bool isJingleRtpFeedbackInterval(const QDomElement &element);
-
-private:
- uint64_t m_value;
-};
-
-class QXMPP_EXPORT QXmppJingleRtpHeaderExtensionProperty
-{
-public:
- enum Senders {
- /// The initiator and the sender are allowed.
- Both,
- /// Only the initiator is allowed.
- Initiator,
- /// Only the responder is allowed.
- Responder
- };
-
- QXmppJingleRtpHeaderExtensionProperty();
-
- QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpHeaderExtensionProperty)
-
- uint32_t id() const;
- void setId(uint32_t id);
-
- QString uri() const;
- void setUri(const QString &uri);
-
- Senders senders() const;
- void setSenders(Senders senders);
-
- QVector<QXmppSdpParameter> parameters() const;
- void setParameters(const QVector<QXmppSdpParameter> &parameters);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- static bool isJingleRtpHeaderExtensionProperty(const QDomElement &element);
-
-private:
- QSharedDataPointer<QXmppJingleRtpHeaderExtensionPropertyPrivate> d;
-};
-
-///
-/// \brief The QXmppJinglePayloadType class represents a payload type
-/// as specified by \xep{0167}: Jingle RTP Sessions and RFC 5245.
-///
-class QXMPP_EXPORT QXmppJinglePayloadType
-{
-public:
- QXmppJinglePayloadType();
- QXmppJinglePayloadType(const QXmppJinglePayloadType &other);
- ~QXmppJinglePayloadType();
-
- unsigned char channels() const;
- void setChannels(unsigned char channels);
-
- unsigned int clockrate() const;
- void setClockrate(unsigned int clockrate);
-
- unsigned char id() const;
- void setId(unsigned char id);
-
- unsigned int maxptime() const;
- void setMaxptime(unsigned int maxptime);
-
- QString name() const;
- void setName(const QString &name);
-
- QMap<QString, QString> parameters() const;
- void setParameters(const QMap<QString, QString> &parameters);
-
- unsigned int ptime() const;
- void setPtime(unsigned int ptime);
-
- QVector<QXmppJingleRtpFeedbackProperty> rtpFeedbackProperties() const;
- void setRtpFeedbackProperties(const QVector<QXmppJingleRtpFeedbackProperty> &rtpFeedbackProperties);
-
- QVector<QXmppJingleRtpFeedbackInterval> rtpFeedbackIntervals() const;
- void setRtpFeedbackIntervals(const QVector<QXmppJingleRtpFeedbackInterval> &rtpFeedbackIntervals);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- QXmppJinglePayloadType &operator=(const QXmppJinglePayloadType &other);
- bool operator==(const QXmppJinglePayloadType &other) const;
-
-private:
- QSharedDataPointer<QXmppJinglePayloadTypePrivate> d;
-};
-
-///
-/// \brief The QXmppJingleCandidate class represents a transport candidate
-/// as specified by \xep{0176}: Jingle ICE-UDP Transport Method.
-///
-class QXMPP_EXPORT QXmppJingleCandidate
-{
-public:
- /// This enum is used to describe a candidate's type.
- enum Type {
- HostType, ///< Host candidate, a local address/port.
- PeerReflexiveType, ///< Peer-reflexive candidate,
- ///< the address/port as seen from the peer.
- ServerReflexiveType, ///< Server-reflexive candidate,
- ///< the address/port as seen by the STUN server
- RelayedType ///< Relayed candidate, a candidate from
- ///< a TURN relay.
- };
-
- QXmppJingleCandidate();
- QXmppJingleCandidate(const QXmppJingleCandidate &other);
- QXmppJingleCandidate(QXmppJingleCandidate &&);
- ~QXmppJingleCandidate();
-
- QXmppJingleCandidate &operator=(const QXmppJingleCandidate &other);
- QXmppJingleCandidate &operator=(QXmppJingleCandidate &&);
-
- int component() const;
- void setComponent(int component);
-
- QString foundation() const;
- void setFoundation(const QString &foundation);
-
- int generation() const;
- void setGeneration(int generation);
-
- QHostAddress host() const;
- void setHost(const QHostAddress &host);
-
- QString id() const;
- void setId(const QString &id);
-
- int network() const;
- void setNetwork(int network);
-
- quint16 port() const;
- void setPort(quint16 port);
-
- int priority() const;
- void setPriority(int priority);
-
- QString protocol() const;
- void setProtocol(const QString &protocol);
-
- QXmppJingleCandidate::Type type() const;
- void setType(QXmppJingleCandidate::Type);
-
- bool isNull() const;
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
-
- static QXmppJingleCandidate::Type typeFromString(const QString &typeStr, bool *ok = nullptr);
- static QString typeToString(QXmppJingleCandidate::Type type);
- /// \endcond
-
-private:
- QSharedDataPointer<QXmppJingleCandidatePrivate> d;
-};
-
-///
-/// \brief The QXmppJingleIq class represents an IQ used for initiating media
-/// sessions as specified by \xep{0166}: Jingle.
-///
-/// \ingroup Stanzas
-///
-class QXMPP_EXPORT QXmppJingleIq : public QXmppIq
-{
-public:
- /// This enum is used to describe a Jingle action.
- enum Action {
- ContentAccept,
- ContentAdd,
- ContentModify,
- ContentReject,
- ContentRemove,
- DescriptionInfo,
- SecurityInfo,
- SessionAccept,
- SessionInfo,
- SessionInitiate,
- SessionTerminate,
- TransportAccept,
- TransportInfo,
- TransportReject,
- TransportReplace
- };
-
- enum Creator {
- /// The initiator generated the content type.
- Initiator,
- /// The responder generated the content type.
- Responder
- };
-
- struct RtpSessionStateActive
- {
- };
-
- struct RtpSessionStateHold
- {
- };
-
- struct RtpSessionStateUnhold
- {
- };
-
- struct RtpSessionStateMuting
- {
- /// True when temporarily not sending media to the other party but continuing to accept
- /// media from it, false for ending mute state
- bool isMute = true;
- /// Creator of the corresponding session
- Creator creator;
- /// Session to be muted (e.g., only audio or video)
- QString name;
- };
-
- struct RtpSessionStateRinging
- {
- };
-
- using RtpSessionState = std::variant<RtpSessionStateActive, RtpSessionStateHold, RtpSessionStateUnhold, RtpSessionStateMuting, RtpSessionStateRinging>;
-
- /// \internal
- ///
- /// The QXmppJingleIq::Content class represents the "content" element of a
- /// QXmppJingleIq.
- ///
- class QXMPP_EXPORT Content
- {
- public:
- Content();
- Content(const QXmppJingleIq::Content &other);
- Content(QXmppJingleIq::Content &&);
- ~Content();
-
- Content &operator=(const Content &other);
- Content &operator=(Content &&);
-
- QString creator() const;
- void setCreator(const QString &creator);
-
- QString name() const;
- void setName(const QString &name);
-
- QString senders() const;
- void setSenders(const QString &senders);
-
- // XEP-0167: Jingle RTP Sessions
- QString descriptionMedia() const;
- void setDescriptionMedia(const QString &media);
-
- quint32 descriptionSsrc() const;
- void setDescriptionSsrc(quint32 ssrc);
-
- bool isRtpMultiplexingSupported() const;
- void setRtpMultiplexingSupported(bool isRtpMultiplexingSupported);
-
- std::optional<QXmppJingleRtpEncryption> rtpEncryption() const;
- void setRtpEncryption(const std::optional<QXmppJingleRtpEncryption> &rtpEncryption);
-
- void addPayloadType(const QXmppJinglePayloadType &payload);
- QList<QXmppJinglePayloadType> payloadTypes() const;
- void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
-
- void addTransportCandidate(const QXmppJingleCandidate &candidate);
- QList<QXmppJingleCandidate> transportCandidates() const;
- void setTransportCandidates(const QList<QXmppJingleCandidate> &candidates);
-
- QString transportUser() const;
- void setTransportUser(const QString &user);
-
- QString transportPassword() const;
- void setTransportPassword(const QString &password);
-
- QVector<QXmppJingleRtpFeedbackProperty> rtpFeedbackProperties() const;
- void setRtpFeedbackProperties(const QVector<QXmppJingleRtpFeedbackProperty> &rtpFeedbackProperties);
-
- QVector<QXmppJingleRtpFeedbackInterval> rtpFeedbackIntervals() const;
- void setRtpFeedbackIntervals(const QVector<QXmppJingleRtpFeedbackInterval> &rtpFeedbackIntervals);
-
- QVector<QXmppJingleRtpHeaderExtensionProperty> rtpHeaderExtensionProperties() const;
- void setRtpHeaderExtensionProperties(const QVector<QXmppJingleRtpHeaderExtensionProperty> &rtpHeaderExtensionProperties);
-
- bool isRtpHeaderExtensionMixingAllowed() const;
- void setRtpHeaderExtensionMixingAllowed(bool isRtpHeaderExtensionMixingAllowed);
-
- // XEP-0320: Use of DTLS-SRTP in Jingle Sessions
- QByteArray transportFingerprint() const;
- void setTransportFingerprint(const QByteArray &fingerprint);
-
- QString transportFingerprintHash() const;
- void setTransportFingerprintHash(const QString &hash);
-
- QString transportFingerprintSetup() const;
- void setTransportFingerprintSetup(const QString &setup);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
-
- bool parseSdp(const QString &sdp);
- QString toSdp() const;
- /// \endcond
-
- private:
- QSharedDataPointer<QXmppJingleIqContentPrivate> d;
- };
-
- /// \internal
- ///
- /// The QXmppJingleIq::Reason class represents the "reason" element of a
- /// QXmppJingleIq.
- ///
- class QXMPP_EXPORT Reason
- {
- public:
- /// This enum is used to describe a reason's type.
- enum Type {
- None,
- AlternativeSession,
- Busy,
- Cancel,
- ConnectivityError,
- Decline,
- Expired,
- FailedApplication,
- FailedTransport,
- GeneralError,
- Gone,
- IncompatibleParameters,
- MediaError,
- SecurityError,
- Success,
- Timeout,
- UnsupportedApplications,
- UnsupportedTransports
- };
-
- enum RtpErrorCondition {
- /// There is no error condition.
- NoErrorCondition,
- /// The encryption offer is rejected.
- InvalidCrypto,
- /// Encryption is required but not offered.
- CryptoRequired
- };
-
- Reason();
-
- QString text() const;
- void setText(const QString &text);
-
- Type type() const;
- void setType(Type type);
-
- RtpErrorCondition rtpErrorCondition() const;
- void setRtpErrorCondition(RtpErrorCondition rtpErrorCondition);
-
- /// \cond
- void parse(const QDomElement &element);
- void toXml(QXmlStreamWriter *writer) const;
- /// \endcond
-
- private:
- QString m_text;
- Type m_type;
- RtpErrorCondition m_rtpErrorCondition = NoErrorCondition;
- };
-
- QXmppJingleIq();
- QXmppJingleIq(const QXmppJingleIq &other);
- QXmppJingleIq(QXmppJingleIq &&);
- ~QXmppJingleIq() override;
-
- QXmppJingleIq &operator=(const QXmppJingleIq &other);
- QXmppJingleIq &operator=(QXmppJingleIq &&);
-
- Action action() const;
- void setAction(Action action);
-
- void addContent(const Content &content);
- QList<Content> contents() const;
- void setContents(const QList<Content> &contents);
-
- QString initiator() const;
- void setInitiator(const QString &initiator);
-
- Reason &reason();
- const Reason &reason() const;
-
- QString responder() const;
- void setResponder(const QString &responder);
-
-#if QXMPP_DEPRECATED_SINCE(1, 5)
- QT_DEPRECATED_X("Use QXmpp::rtpSessionState() instead")
- bool ringing() const;
- QT_DEPRECATED_X("Use QXmpp::setRtpSessionState() instead")
- void setRinging(bool ringing);
-#endif
-
- QString sid() const;
- void setSid(const QString &sid);
-
- QString mujiGroupChatJid() const;
- void setMujiGroupChatJid(const QString &mujiGroupChatJid);
-
- std::optional<RtpSessionState> rtpSessionState() const;
- void setRtpSessionState(const std::optional<RtpSessionState> &rtpSessionState);
-
- /// \cond
- static bool isJingleIq(const QDomElement &element);
- /// \endcond
-
-protected:
- /// \cond
- void parseElementFromChild(const QDomElement &element) override;
- void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
- /// \endcond
-
-private:
- QSharedDataPointer<QXmppJingleIqPrivate> d;
-};
-
-Q_DECLARE_METATYPE(QXmppJingleIq::Reason::RtpErrorCondition)
-
-#endif
+#include "QXmppJingleData.h"
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"));
diff --git a/src/base/QXmppMessage.h b/src/base/QXmppMessage.h
index be9e9b96..cf6df18d 100644
--- a/src/base/QXmppMessage.h
+++ b/src/base/QXmppMessage.h
@@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
// SPDX-FileCopyrightText: 2018 Linus Jahn <lnj@kaidan.im>
// SPDX-FileCopyrightText: 2020 Melvin Keskin <melvo@olomono.de>
+// SPDX-FileCopyrightText: 2023 Tibor Csötönyi <work@taibsu.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
@@ -18,6 +19,7 @@
class QXmppMessagePrivate;
class QXmppBitsOfBinaryDataList;
+class QXmppJingleMessageInitiationElement;
class QXmppMessageReaction;
class QXmppMixInvitation;
#ifdef BUILD_OMEMO
@@ -205,6 +207,10 @@ public:
void removeHint(const Hint hint);
void removeAllHints();
+ // XEP-0353: Jingle Message Initiation
+ std::optional<QXmppJingleMessageInitiationElement> jingleMessageInitiationElement() const;
+ void setJingleMessageInitiationElement(const std::optional<QXmppJingleMessageInitiationElement> &jingleMessageInitiationElement);
+
// XEP-0359: Unique and Stable Stanza IDs
QString stanzaId() const;
void setStanzaId(const QString &id);