forked from blue/squawk
some further work on omemo, far from done yet
This commit is contained in:
parent
6f32e99593
commit
77dd28b600
18 changed files with 161 additions and 43 deletions
|
@ -17,6 +17,8 @@
|
|||
#include "vcardhandler.h"
|
||||
#include "core/account.h"
|
||||
|
||||
constexpr const char* ns_omemo_2 = "urn:xmpp:omemo:2";
|
||||
|
||||
Core::VCardHandler::VCardHandler(Account* account):
|
||||
QObject(),
|
||||
acc(account),
|
||||
|
@ -102,6 +104,20 @@ void Core::VCardHandler::onVCardReceived(const QXmppVCardIq& card) {
|
|||
|
||||
Shared::Info info(jid, Shared::EntryType::contact);
|
||||
item->handleResponseVCard(card, resource, info.getVCardRef());
|
||||
#ifdef WITH_OMEMO
|
||||
std::list<Shared::KeyInfo>& aks = info.getActiveKeysRef();
|
||||
acc->oh->getDevices(jid, aks);
|
||||
std::map<QByteArray, Shared::TrustLevel> trustLevels = acc->th->getKeys(ns_omemo_2, jid);
|
||||
|
||||
qDebug() << "OMEMO info for " << jid << " devices:" << aks.size() << ", trustLevels:" << trustLevels.size();
|
||||
for (Shared::KeyInfo& key : aks) {
|
||||
std::map<QByteArray, Shared::TrustLevel>::const_iterator itr = trustLevels.find(key.fingerPrint);
|
||||
if (itr != trustLevels.end()) {
|
||||
key.trustLevel = itr->second;
|
||||
qDebug() << "Found a trust level for a device!";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
emit acc->infoReady(info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue