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);
}
}
}
}
}

View file

@ -32,6 +32,7 @@
#include <QXmppMucManager.h>
#include <QXmppRosterIq.h>
#include <shared/enums.h>
#include <shared/message.h>
#include <core/contact.h>
#include <core/conference.h>
@ -64,7 +65,7 @@ public:
void storeConferences();
void clearConferences();
void setPepSupport(bool support);
void setPepSupport(Shared::Support support);
private slots:
void onRosterReceived();
@ -108,7 +109,7 @@ private:
std::map<QString, std::set<QString>> groups;
std::map<QString, QString> queuedContacts;
std::set<QString> outOfRosterContacts;
bool pepSupport;
Shared::Support pepSupport;
};
}