forked from blue/squawk
showing the button for encryption if there is at least one omemo key, trust summary update calculations
This commit is contained in:
parent
4f295fee3c
commit
69d797fe51
9 changed files with 134 additions and 39 deletions
|
@ -39,6 +39,10 @@ void Core::RosterHandler::initialize() {
|
|||
connect(acc->bm, &QXmppBookmarkManager::bookmarksReceived, this, &RosterHandler::bookmarksReceived);
|
||||
|
||||
connect(acc, &Account::pepSupportChanged, this, &RosterHandler::onPepSupportedChanged);
|
||||
|
||||
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0)
|
||||
connect(acc->th, &TrustHandler::trustLevelsChanged, this, &RosterHandler::onTrustChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
Core::RosterHandler::~RosterHandler() {
|
||||
|
@ -214,10 +218,13 @@ void Core::RosterHandler::onContactGroupAdded(const QString& group) {
|
|||
if (contact->groupsCount() == 1) {
|
||||
// not sure i need to handle it here, the situation with grouped and ungrouped contacts handled on the client anyway
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> cData({
|
||||
{"name", contact->getName()},
|
||||
{"state", QVariant::fromValue(contact->getSubscriptionState())},
|
||||
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0)
|
||||
{"trust", QVariant::fromValue(acc->th->getSummary(contact->jid))},
|
||||
#endif
|
||||
{"encryption", contact->isEncryptionEnabled()}
|
||||
});
|
||||
addToGroup(contact->jid, group);
|
||||
|
@ -229,7 +236,7 @@ void Core::RosterHandler::onContactGroupRemoved(const QString& group) {
|
|||
if (contact->groupsCount() == 0) {
|
||||
// not sure i need to handle it here, the situation with grouped and ungrouped contacts handled on the client anyway
|
||||
}
|
||||
|
||||
|
||||
emit acc->removeContact(contact->jid, group);
|
||||
removeFromGroup(contact->jid, group);
|
||||
}
|
||||
|
@ -246,12 +253,14 @@ void Core::RosterHandler::onContactEncryptionChanged(bool value) {
|
|||
|
||||
void Core::RosterHandler::onContactSubscriptionStateChanged(Shared::SubscriptionState cstate) {
|
||||
Contact* contact = static_cast<Contact*>(sender());
|
||||
QMap<QString, QVariant> cData({
|
||||
{"state", QVariant::fromValue(cstate)},
|
||||
});
|
||||
emit acc->changeContact(contact->jid, cData);
|
||||
emit acc->changeContact(contact->jid, {{"state", QVariant::fromValue(cstate)}});
|
||||
}
|
||||
|
||||
void Core::RosterHandler::onTrustChanged(const QString& jid, const Shared::TrustSummary& trust) {
|
||||
emit acc->changeContact(jid, {{"trust", QVariant::fromValue(trust)}});
|
||||
}
|
||||
|
||||
|
||||
void Core::RosterHandler::addToGroup(const QString& jid, const QString& group) {
|
||||
std::map<QString, std::set<QString>>::iterator gItr = groups.find(group);
|
||||
if (gItr == groups.end()) {
|
||||
|
@ -296,18 +305,18 @@ Core::RosterItem * Core::RosterHandler::getRosterItem(const QString& jid) {
|
|||
Core::Conference * Core::RosterHandler::getConference(const QString& jid) {
|
||||
Conference* item = 0;
|
||||
std::map<QString, Conference*>::const_iterator coitr = conferences.find(jid.toLower());
|
||||
if (coitr != conferences.end()) {
|
||||
if (coitr != conferences.end())
|
||||
item = coitr->second;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
Core::Contact * Core::RosterHandler::getContact(const QString& jid) {
|
||||
Contact* item = 0;
|
||||
std::map<QString, Contact*>::const_iterator citr = contacts.find(jid.toLower());
|
||||
if (citr != contacts.end()) {
|
||||
if (citr != contacts.end())
|
||||
item = citr->second;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -527,7 +536,6 @@ void Core::RosterHandler::handleOffline() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Core::RosterHandler::onPepSupportedChanged(Shared::Support support) {
|
||||
if (support == Shared::Support::supported) {
|
||||
for (const std::pair<const QString, Contact*>& pair : contacts) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue