Now avatars are properly autogenerated, reduced vCard spam

This commit is contained in:
Blue 2024-01-31 20:22:49 -03:00
parent 93c5be412e
commit 0be2648849
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
9 changed files with 76 additions and 92 deletions

View file

@ -98,13 +98,13 @@ void Core::RosterHandler::addedAccount(const QString& jid) {
contact->setName(re.name());
if (newContact) {
handleNewContact(contact);
QMap<QString, QVariant> cData = contact->getInfo();
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0)
cData.insert("trust", QVariant::fromValue(acc->th->getSummary(jid)));
#endif
int grCount = 0;
for (QSet<QString>::const_iterator itr = gr.begin(), end = gr.end(); itr != end; ++itr) {
const QString& groupName = *itr;
for (const QString& groupName : gr) {
addToGroup(jid, groupName);
emit acc->addContact(jid, groupName, cData);
grCount++;
@ -117,7 +117,6 @@ void Core::RosterHandler::addedAccount(const QString& jid) {
acc->dm->requestInfo(jid);
//acc->dm->requestItems(jid);
}
handleNewContact(contact);
}
}
@ -495,22 +494,23 @@ void Core::RosterHandler::removeContactFromGroupRequest(const QString& jid, cons
if (itr == contacts.end()) {
qDebug() << "An attempt to remove non existing contact" << lcJid << "of account"
<< acc->name << "from the group" << groupName << ", skipping";
return;
}
QXmppRosterIq::Item item = acc->rm->getRosterEntry(lcJid);
QSet<QString> groups = item.groups();
QSet<QString>::const_iterator gItr = groups.find(groupName);
if (gItr != groups.end()) {
groups.erase(gItr);
item.setGroups(groups);
QXmppRosterIq iq;
iq.setType(QXmppIq::Set);
iq.addItem(item);
acc->client.sendPacket(iq);
} else {
QXmppRosterIq::Item item = acc->rm->getRosterEntry(lcJid);
QSet<QString> groups = item.groups();
QSet<QString>::const_iterator gItr = groups.find(groupName);
if (gItr != groups.end()) {
groups.erase(gItr);
item.setGroups(groups);
QXmppRosterIq iq;
iq.setType(QXmppIq::Set);
iq.addItem(item);
acc->client.sendPacket(iq);
} else {
qDebug() << "An attempt to remove contact" << lcJid << "of account"
<< acc->name << "from the group" << groupName << "but it's not in that group, skipping";
}
qDebug() << "An attempt to remove contact" << lcJid << "of account"
<< acc->name << "from the group" << groupName << "but it's not in that group, skipping";
}
}