1
0
Fork 0
forked from blue/squawk

some new shared classes, little reorganization, preparation to cache client info

This commit is contained in:
Blue 2022-08-22 23:29:43 +03:00
parent 2ae75a4b91
commit 037dabbe06
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
20 changed files with 297 additions and 32 deletions

View file

@ -285,7 +285,10 @@ void Core::Account::onPresenceReceived(const QXmppPresence& p_presence)
emit addPresence(jid, resource, {
{"lastActivity", lastInteraction},
{"availability", p_presence.availableStatusType()}, //TODO check and handle invisible
{"status", p_presence.statusText()}
{"status", p_presence.statusText()},
{"capabilityNode", p_presence.capabilityNode()},
{"capabilityVer", p_presence.capabilityVer().toBase64()},
{"capabilityHash", p_presence.capabilityHash()}
});
}
break;
@ -594,7 +597,8 @@ void Core::Account::onDiscoveryItemsReceived(const QXmppDiscoveryIq& items)
void Core::Account::onDiscoveryInfoReceived(const QXmppDiscoveryIq& info)
{
if (info.from() == getServer()) {
QString from = info.from();
if (from == getServer()) {
bool enableCC = false;
qDebug() << "Server info received for account" << name;
QStringList features = info.features();
@ -613,7 +617,7 @@ void Core::Account::onDiscoveryInfoReceived(const QXmppDiscoveryIq& info)
qDebug() << "Requesting account" << name << "capabilities";
dm->requestInfo(getBareJid());
} else if (info.from() == getBareJid()) {
} else if (from == getBareJid()) {
qDebug() << "Received capabilities for account" << name << ":";
QList<QXmppDiscoveryIq::Identity> identities = info.identities();
bool pepSupported = false;
@ -626,10 +630,27 @@ void Core::Account::onDiscoveryInfoReceived(const QXmppDiscoveryIq& info)
}
rh->setPepSupport(pepSupported);
} else {
qDebug() << "Received info for account" << name << "about" << info.from();
QList<QXmppDiscoveryIq::Identity> identities = info.identities();
for (const QXmppDiscoveryIq::Identity& identity : identities) {
qDebug() << " " << identity.name() << identity.category() << identity.type();
qDebug() << "Received info for account" << name << "about" << from;
QString node = info.queryNode();
if (!node.isEmpty()) {
QStringList feats = info.features();
std::list<Shared::Identity> identities;
std::set<QString> features(feats.begin(), feats.end());
QList<QXmppDiscoveryIq::Identity> idents = info.identities();
for (const QXmppDiscoveryIq::Identity& ident : idents) {
identities.emplace_back();
Shared::Identity& identity = identities.back();
identity.category = ident.category();
identity.language = ident.language();
identity.name = ident.name();
identity.type = ident.type();
qDebug() << " " << identity.name << identity.category << identity.type;
}
for (const QString& feat : features) {
qDebug() << " " << feat;
}
emit infoDiscovered(from, node, identities, features);
}
}
}