-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update XEP-0428: Fallback Indication to v0.2
Introduces new QXmppFallback class for providing the new body/subject text references. https://xmpp.org/extensions/xep-0428.html
- Loading branch information
Showing
6 changed files
with
270 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// SPDX-FileCopyrightText: 2024 Linus Jahn <lnj@kaidan.im> | ||
// | ||
// SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
#ifndef QXMPPFALLBACK_H | ||
#define QXMPPFALLBACK_H | ||
|
||
#include "QXmppGlobal.h" | ||
|
||
#include <optional> | ||
|
||
#include <QSharedDataPointer> | ||
|
||
class QDomElement; | ||
class QXmlStreamWriter; | ||
|
||
struct QXmppFallbackPrivate; | ||
|
||
class QXMPP_EXPORT QXmppFallback | ||
{ | ||
public: | ||
enum Element { | ||
Body, | ||
Subject, | ||
}; | ||
|
||
struct Range { | ||
/// Start index of the range | ||
uint32_t start; | ||
/// End index of the range | ||
uint32_t end; | ||
}; | ||
|
||
struct Reference { | ||
/// Element of the message stanza this refers to | ||
Element element; | ||
/// Optional character range in the text | ||
std::optional<Range> range; | ||
}; | ||
|
||
QXmppFallback(const QString &forNamespace, const QVector<Reference> &references); | ||
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppFallback) | ||
|
||
const QString &forNamespace() const; | ||
void setForNamespace(const QString &); | ||
|
||
const QVector<Reference> &references() const; | ||
void setReferences(const QVector<Reference> &); | ||
|
||
static std::optional<QXmppFallback> fromDom(const QDomElement &); | ||
void toXml(QXmlStreamWriter *) const; | ||
|
||
private: | ||
QSharedDataPointer<QXmppFallbackPrivate> d; | ||
}; | ||
|
||
#endif // QXMPPFALLBACK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.