forked from blue/squawk
removed own VCard request at the start if the presence doesn't show that the avatar changed, little refactoring
This commit is contained in:
parent
7b2b7ee5d5
commit
b6ba022bff
10 changed files with 215 additions and 129 deletions
|
@ -26,8 +26,7 @@ Core::RosterHandler::RosterHandler(Core::Account* account):
|
|||
conferences(),
|
||||
groups(),
|
||||
queuedContacts(),
|
||||
outOfRosterContacts(),
|
||||
pepSupport(Shared::Support::unknown)
|
||||
outOfRosterContacts()
|
||||
{
|
||||
connect(acc->rm, &QXmppRosterManager::rosterReceived, this, &RosterHandler::onRosterReceived);
|
||||
connect(acc->rm, &QXmppRosterManager::itemAdded, this, &RosterHandler::onRosterItemAdded);
|
||||
|
@ -37,6 +36,8 @@ Core::RosterHandler::RosterHandler(Core::Account* account):
|
|||
|
||||
connect(acc->mm, &QXmppMucManager::roomAdded, this, &RosterHandler::onMucRoomAdded);
|
||||
connect(acc->bm, &QXmppBookmarkManager::bookmarksReceived, this, &RosterHandler::bookmarksReceived);
|
||||
|
||||
connect(acc, &Account::pepSupportChanged, this, &RosterHandler::onPepSupportedChanged);
|
||||
}
|
||||
|
||||
Core::RosterHandler::~RosterHandler()
|
||||
|
@ -52,8 +53,6 @@ Core::RosterHandler::~RosterHandler()
|
|||
|
||||
void Core::RosterHandler::onRosterReceived()
|
||||
{
|
||||
acc->requestVCard(acc->getBareJid()); //TODO need to make sure server actually supports vCards
|
||||
|
||||
QStringList bj = acc->rm->getRosterBareJids();
|
||||
for (int i = 0; i < bj.size(); ++i) {
|
||||
const QString& jid = bj[i];
|
||||
|
@ -111,7 +110,7 @@ void Core::RosterHandler::addedAccount(const QString& jid)
|
|||
if (grCount == 0) {
|
||||
emit acc->addContact(jid, "", cData);
|
||||
}
|
||||
if (pepSupport == Shared::Support::supported) {
|
||||
if (acc->pepSupport == Shared::Support::supported) {
|
||||
acc->dm->requestInfo(jid);
|
||||
//acc->dm->requestItems(jid);
|
||||
}
|
||||
|
@ -592,20 +591,15 @@ void Core::RosterHandler::handleOffline()
|
|||
pair.second->clearArchiveRequests();
|
||||
pair.second->downgradeDatabaseState();
|
||||
}
|
||||
setPepSupport(Shared::Support::unknown);
|
||||
}
|
||||
|
||||
|
||||
void Core::RosterHandler::setPepSupport(Shared::Support support)
|
||||
void Core::RosterHandler::onPepSupportedChanged(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);
|
||||
}
|
||||
if (support == Shared::Support::supported) {
|
||||
for (const std::pair<const QString, Contact*>& pair : contacts) {
|
||||
if (pair.second->getPepSupport() == Shared::Support::unknown) {
|
||||
acc->dm->requestInfo(pair.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue