forked from blue/squawk
work progress: trust manager. DOESN'T START!
This commit is contained in:
parent
0b61b6e928
commit
db3bc358a7
20 changed files with 634 additions and 55 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue