2021-05-12 09:33:35 +00:00
|
|
|
/*
|
|
|
|
* Created by victoria on 2021-05-12.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QXmppPubSubIq.h>
|
|
|
|
|
2021-05-12 12:00:41 +00:00
|
|
|
#include <QDateTime>
|
|
|
|
#include <QXmppMessage.h>
|
|
|
|
|
|
|
|
namespace QXmpp::Omemo {
|
2021-05-12 09:33:35 +00:00
|
|
|
|
|
|
|
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:
|
2021-05-12 12:00:41 +00:00
|
|
|
[[nodiscard]] static QXmppPubSubIq fetchDeviceBundleIq(int deviceId);
|
|
|
|
|
2021-05-12 09:33:35 +00:00
|
|
|
[[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;
|
|
|
|
};
|
|
|
|
|
2021-05-12 12:00:41 +00:00
|
|
|
class MessageKey {
|
|
|
|
public:
|
|
|
|
[[nodiscard]] QXmppElement toXml() const;
|
|
|
|
|
|
|
|
bool kex{};
|
|
|
|
QString key{};
|
|
|
|
};
|
|
|
|
|
|
|
|
class HeaderKeys {
|
|
|
|
public:
|
|
|
|
[[nodiscard]] QXmppElement toXml() const;
|
|
|
|
|
|
|
|
QString jid{};
|
|
|
|
QList<MessageKey> keys{};
|
|
|
|
};
|
|
|
|
|
|
|
|
class EncryptedMessage {
|
|
|
|
public:
|
|
|
|
[[nodiscard]] QXmppElement header() const;
|
|
|
|
[[nodiscard]] QXmppElement content() const;
|
|
|
|
[[nodiscard]] QXmppElement toXml() const;
|
|
|
|
[[nodiscard]] QXmppElement payload() const;
|
|
|
|
|
|
|
|
int fromDeviceId{};
|
|
|
|
|
|
|
|
QList<HeaderKeys> keys{};
|
|
|
|
QString from{};
|
|
|
|
QString to{};
|
|
|
|
QDateTime timestamp{};
|
|
|
|
|
|
|
|
QXmppMessage message{};
|
|
|
|
};
|
|
|
|
|
2021-05-12 09:33:35 +00:00
|
|
|
} // namespace QOmemo
|