first thought about forms, discovering contact pep support

This commit is contained in:
Blue 2022-08-26 01:49:49 +03:00
parent c50cd1140e
commit 7b2b7ee5d5
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
11 changed files with 230 additions and 9 deletions

View file

@ -27,7 +27,7 @@ Core::RosterHandler::RosterHandler(Core::Account* account):
groups(),
queuedContacts(),
outOfRosterContacts(),
pepSupport(false)
pepSupport(Shared::Support::unknown)
{
connect(acc->rm, &QXmppRosterManager::rosterReceived, this, &RosterHandler::onRosterReceived);
connect(acc->rm, &QXmppRosterManager::itemAdded, this, &RosterHandler::onRosterItemAdded);
@ -111,6 +111,10 @@ void Core::RosterHandler::addedAccount(const QString& jid)
if (grCount == 0) {
emit acc->addContact(jid, "", cData);
}
if (pepSupport == Shared::Support::supported) {
acc->dm->requestInfo(jid);
//acc->dm->requestItems(jid);
}
handleNewContact(contact);
}
}
@ -588,13 +592,21 @@ void Core::RosterHandler::handleOffline()
pair.second->clearArchiveRequests();
pair.second->downgradeDatabaseState();
}
setPepSupport(false);
setPepSupport(Shared::Support::unknown);
}
void Core::RosterHandler::setPepSupport(bool support)
void Core::RosterHandler::setPepSupport(Shared::Support support)
{
if (pepSupport != support) {
pepSupport = support;
if (pepSupport == Shared::Support::supported) {
for (const std::pair<const QString, Contact*>& pair : contacts) {
if (pair.second->getPepSupport() == Shared::Support::unknown) {
acc->dm->requestInfo(pair.first);
}
}
}
}
}