-
Notifications
You must be signed in to change notification settings - Fork 195
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 and QXmppFallbackReference classes for providing the new information. https://xmpp.org/extensions/xep-0428.html
- Loading branch information
Showing
6 changed files
with
317 additions
and
16 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,65 @@ | ||
// 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 QXmppFallbackReference | ||
{ | ||
public: | ||
enum Element { | ||
Body, | ||
Subject, | ||
}; | ||
|
||
struct Range { | ||
uint32_t start; | ||
uint32_t end; | ||
}; | ||
|
||
QXmppFallbackReference(Element element, std::optional<Range> range = {}); | ||
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppFallbackReference) | ||
|
||
Element element() const; | ||
void setElement(Element); | ||
|
||
std::optional<Range> range() const; | ||
void setRange(std::optional<Range>); | ||
|
||
private: | ||
Element m_element; | ||
std::optional<Range> m_range; | ||
}; | ||
|
||
class QXmppFallback | ||
{ | ||
public: | ||
QXmppFallback(const QString &forNamespace, const QVector<QXmppFallbackReference> &references); | ||
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppFallback) | ||
|
||
const QString &forNamespace() const; | ||
void setForNamespace(const QString &); | ||
|
||
const QVector<QXmppFallbackReference> &references() const; | ||
void setReferences(const QVector<QXmppFallbackReference> &); | ||
|
||
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.