QXmpp: QXmppOmemoElement_p.h Source File

QXmpp Version: 1.14.3

Loading...
Searching...
No Matches
QXmppOmemoElement_p.h
1// SPDX-FileCopyrightText: 2021 Germán Márquez Mejía <mancho@olomono.de>
2// SPDX-FileCopyrightText: 2021 Melvin Keskin <melvo@olomono.de>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef QXMPPOMEMOELEMENT_H
7#define QXMPPOMEMOELEMENT_H
8
9#include "QXmppGlobal.h"
10#include "QXmppOmemoEnvelope_p.h"
11
12#include <optional>
13
14#include <QMultiMap>
15
16class QDomElement;
17class QXmlStreamWriter;
18
19class QXMPP_EXPORT QXmppOmemoElement
20{
21public:
22 uint32_t senderDeviceId() const;
23 void setSenderDeviceId(uint32_t id);
24
25 QByteArray payload() const;
26 void setPayload(const QByteArray &payload);
27
28 std::optional<QXmppOmemoEnvelope> searchEnvelope(const QString &recipientJid, uint32_t recipientDeviceId) const;
29 void addEnvelope(const QString &recipientJid, const QXmppOmemoEnvelope &envelope);
30
32 void parse(const QDomElement &element);
33 void toXml(QXmlStreamWriter *writer) const;
35
36 static bool isOmemoElement(const QDomElement &element);
37
38private:
39 uint32_t m_senderDeviceId = 0;
40 QByteArray m_payload;
41 QMultiMap<QString, QXmppOmemoEnvelope> m_envelopes;
42};
43
44Q_DECLARE_TYPEINFO(QXmppOmemoElement, Q_MOVABLE_TYPE);
45
46#endif // QXMPPOMEMOELEMENT_H