1
0
Fork 0
forked from blue/squawk

first ever received and cached client data!

This commit is contained in:
Blue 2022-08-25 01:41:06 +03:00
parent 037dabbe06
commit c50cd1140e
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
11 changed files with 297 additions and 60 deletions

View file

@ -320,25 +320,27 @@ void Core::Squawk::onAccountAddPresence(const QString& jid, const QString& name,
Account* acc = static_cast<Account*>(sender());
emit addPresence(acc->getName(), jid, name, data);
QString node = data["capabilityNode"].toString();
QString ver = data["capabilityVer"].toString();
QString hash = data["capabilityHash"].toString();
if (!clientCache.checkClient(node, ver, hash)) {
acc->discoverInfo(jid + "/" + name, node + "/" + ver);
//it's equal if a MUC sends its status with presence of the same jid (ex: muc@srv.im/muc@srv.im), it's not a client, so, no need to request
if (jid != name) {
QString node = data["capabilityNode"].toString();
QString ver = data["capabilityVer"].toString();
QString hash = data["capabilityHash"].toString();
if (!clientCache.checkClient(node, ver, hash)) {
acc->discoverInfo(jid + "/" + name, node + "/" + ver);
}
}
}
void Core::Squawk::onAccountInfoDiscovered(
const QString& address,
const QString& node,
const std::list<Shared::Identity>& identities,
const std::set<Shared::Identity>& identities,
const std::set<QString>& features)
{
Account* acc = static_cast<Account*>(sender());
if (identities.size() != 1 || clientCache.registerClientInfo(address, node, identities.back(), features)) {
if (!clientCache.registerClientInfo(address, node, identities, features)) {
qDebug() << "Account" << acc->getName() << "received an ill-formed client discovery response from" << address << "about" << node;
return;
}
}