new fallback icons, new fields in vCard, fix about recreation new avatar on each request

This commit is contained in:
Blue 2019-10-25 16:38:48 +03:00
parent 36c71968bc
commit 566fc1f2fb
25 changed files with 629 additions and 205 deletions

View file

@ -934,3 +934,23 @@ bool Models::Roster::groupHasContact(const QString& account, const QString& grou
return gr->hasContact(contact);
}
}
QString Models::Roster::getContactIconPath(const QString& account, const QString& jid)
{
ElId id(account, jid);
std::multimap<ElId, Contact*>::const_iterator cItr = contacts.find(id);
QString path = "";
if (cItr == contacts.end()) {
std::map<ElId, Room*>::const_iterator rItr = rooms.find(id);
if (rItr == rooms.end()) {
qDebug() << "An attempt to get an icon path of non existing contact" << account << ":" << jid << ", returning empty value";
} else {
//path = rItr->second->getRoomName();
}
} else {
if (cItr->second->getAvatarState() != Shared::Avatar::empty) {
path = cItr->second->getAvatarPath();
}
}
return path;
}

View file

@ -73,6 +73,7 @@ public:
std::deque<QString> groupList(const QString& account) const;
bool groupHasContact(const QString& account, const QString& group, const QString& contactJID) const;
QString getContactIconPath(const QString& account, const QString& jid);
Accounts* accountsModel;