feat(OMEMO): add Device, DeviceList, PreKey, Bundle + XML

This commit is contained in:
vae 2021-05-12 12:33:35 +03:00
parent a6254d88b3
commit b22a4c8ca3
Signed by: vae
GPG key ID: A9A33351400E00E5
3 changed files with 305 additions and 1 deletions

56
qomemo/qomemo.h Normal file
View file

@ -0,0 +1,56 @@
/*
* Created by victoria on 2021-05-12.
*/
#pragma once
#include <QXmppPubSubIq.h>
namespace QOmemo {
class Device {
public:
[[nodiscard]] QXmppElement toXml() const;
void fromXml(const QXmppElement &element);
int id;
QString label;
};
class DeviceList {
public:
[[nodiscard]] QXmppElement toXml() const;
[[nodiscard]] QXmppIq toIq() const;
/// Expects a urn:xmpp:omemo:1:devices node
void fromXml(const QXmppElement &element);
private:
QList<Device> devices;
};
class PreKey {
public:
[[nodiscard]] QXmppElement toXml() const;
/// Expects a <pk>
void fromXml(const QXmppElement &element);
int id;
QString data;
};
class Bundle {
public:
[[nodiscard]] QXmppElement toXml() const;
[[nodiscard]] QXmppIq toIq() const;
void fromXml(const QXmppElement &element);
int deviceId;
QString spk;
int spkId;
QString spks;
QString ik;
QList<PreKey> prekeys;
};
} // namespace QOmemo