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

@ -19,27 +19,28 @@
#include <QDebug>
Core::ClientCache::ClientCache():
db("clients"),
cache(db.addCache<QString, Shared::ClientInfo>("info")),
requested(),
cache("clients"),
specific()
{
cache.open();
db.open();
}
Core::ClientCache::~ClientCache() {
cache.close();
db.close();
}
void Core::ClientCache::open() {
cache.open();}
db.open();}
void Core::ClientCache::close() {
cache.close();}
db.close();}
bool Core::ClientCache::checkClient(const QString& node, const QString& ver, const QString& hash) {
QString id = node + "/" + ver;
if (requested.count(id) == 0 && !cache.checkRecord(id)) {
if (requested.count(id) == 0 && !cache->checkRecord(id)) {
Shared::ClientInfo& info = requested.insert(std::make_pair(id, Shared::ClientInfo())).first->second;
info.node = node;
info.verification = ver;
@ -65,7 +66,7 @@ bool Core::ClientCache::registerClientInfo (
bool valid = info.valid();
if (valid) {
cache.addRecord(id, info);
cache->addRecord(id, info);
} else {
info.specificPresence = sourceFullJid;
specific.insert(std::make_pair(sourceFullJid, info));