work progress: trust manager. DOESN'T START!

This commit is contained in:
Blue 2022-12-19 18:43:24 +03:00
parent 0b61b6e928
commit db3bc358a7
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
20 changed files with 634 additions and 55 deletions

View file

@ -22,7 +22,7 @@ Core::OmemoHandler::OmemoHandler(Account* account) :
QXmppOmemoStorage(),
acc(account),
ownDevice(std::nullopt),
db("omemo"),
db(acc->getName() + "/omemo"),
meta(db.addCache<QString, QVariant>("meta")),
devices(db.addCache<QString, QHash<uint32_t, Device>>("devices")),
preKeyPairs(db.addCache<uint32_t, QByteArray>("preKeyPairs")),
@ -155,7 +155,60 @@ QFuture<void> Core::OmemoHandler::resetAll() {
return emptyVoidFuture();
}
QDataStream & operator >> (QDataStream& in, QXmppOmemoStorage::Device& device) {
in >> device.label;
in >> device.keyId;
in >> device.session;
in >> device.unrespondedSentStanzasCount;
in >> device.unrespondedReceivedStanzasCount;
in >> device.removalFromDeviceListDate;
return in;
}
QDataStream & operator << (QDataStream& out, const QXmppOmemoStorage::Device& device) {
out << device.label;
out << device.keyId;
out << device.session;
out << device.unrespondedSentStanzasCount;
out << device.unrespondedReceivedStanzasCount;
out << device.removalFromDeviceListDate;
return out;
}
QDataStream & operator >> (QDataStream& in, QXmppOmemoStorage::OwnDevice& device) {
in >> device.id;
in >> device.label;
in >> device.privateIdentityKey;
in >> device.publicIdentityKey;
in >> device.latestSignedPreKeyId;
in >> device.latestPreKeyId;
return in;
}
QDataStream & operator << (QDataStream& out, const QXmppOmemoStorage::OwnDevice& device) {
out << device.id;
out << device.label;
out << device.privateIdentityKey;
out << device.publicIdentityKey;
out << device.latestSignedPreKeyId;
out << device.latestPreKeyId;
return out;
}
QDataStream & operator >> (QDataStream& in, QXmppOmemoStorage::SignedPreKeyPair& pair) {
in >> pair.creationDate;
in >> pair.data;
return in;
}
QDataStream & operator << (QDataStream& out, const QXmppOmemoStorage::SignedPreKeyPair& pair) {
out << pair.creationDate;
out << pair.data;
return out;
}