avatars for mucs, some tooltip tweaks
This commit is contained in:
parent
f367502b8e
commit
867c3a18e9
6 changed files with 111 additions and 18 deletions
|
@ -440,25 +440,34 @@ void Core::Account::onPresenceReceived(const QXmppPresence& p_presence)
|
|||
}
|
||||
} else {
|
||||
if (pendingVCardRequests.find(jid) == pendingVCardRequests.end()) {
|
||||
RosterItem* item = 0;
|
||||
std::map<QString, Contact*>::const_iterator itr = contacts.find(jid);
|
||||
if (itr != contacts.end()) {
|
||||
Contact* cnt = itr->second;
|
||||
item = itr->second;
|
||||
} else {
|
||||
std::map<QString, Conference*>::const_iterator citr = conferences.find(jid);
|
||||
if (citr != conferences.end()) {
|
||||
item = citr->second;
|
||||
}
|
||||
}
|
||||
|
||||
if (item != 0) {
|
||||
switch (p_presence.vCardUpdateType()) {
|
||||
case QXmppPresence::VCardUpdateNone: //this presence has nothing to do with photo
|
||||
break;
|
||||
case QXmppPresence::VCardUpdateNotReady: //let's say the photo didn't change here
|
||||
break;
|
||||
case QXmppPresence::VCardUpdateNoPhoto: //there is no photo, need to drop if any
|
||||
if (!cnt->hasAvatar() || (cnt->hasAvatar() && !cnt->isAvatarAutoGenerated())) {
|
||||
cnt->setAutoGeneratedAvatar();
|
||||
if (!item->hasAvatar() || (item->hasAvatar() && !item->isAvatarAutoGenerated())) {
|
||||
item->setAutoGeneratedAvatar();
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case QXmppPresence::VCardUpdateValidPhoto: //there is a photo, need to load
|
||||
if (cnt->hasAvatar()) {
|
||||
if (cnt->isAvatarAutoGenerated()) {
|
||||
if (item->hasAvatar()) {
|
||||
if (item->isAvatarAutoGenerated()) {
|
||||
requestVCard(jid);
|
||||
} else {
|
||||
if (cnt->avatarHash() != p_presence.photoHash()) {
|
||||
if (item->avatarHash() != p_presence.photoHash()) {
|
||||
requestVCard(jid);
|
||||
}
|
||||
}
|
||||
|
@ -1317,12 +1326,27 @@ void Core::Account::addNewRoom(const QString& jid, const QString& nick, const QS
|
|||
|
||||
handleNewConference(conf);
|
||||
|
||||
emit addRoom(jid, {
|
||||
QMap<QString, QVariant> cData = {
|
||||
{"autoJoin", conf->getAutoJoin()},
|
||||
{"joined", conf->getJoined()},
|
||||
{"nick", conf->getNick()},
|
||||
{"name", conf->getName()}
|
||||
});
|
||||
};
|
||||
|
||||
if (conf->hasAvatar()) {
|
||||
if (!conf->isAvatarAutoGenerated()) {
|
||||
cData.insert("avatarState", static_cast<uint>(Shared::Avatar::valid));
|
||||
} else {
|
||||
cData.insert("avatarState", static_cast<uint>(Shared::Avatar::autocreated));
|
||||
}
|
||||
cData.insert("avatarPath", conf->avatarPath());
|
||||
} else {
|
||||
cData.insert("avatarState", static_cast<uint>(Shared::Avatar::empty));
|
||||
cData.insert("avatarPath", "");
|
||||
requestVCard(jid);
|
||||
}
|
||||
|
||||
emit addRoom(jid, cData);
|
||||
}
|
||||
|
||||
void Core::Account::addContactToGroupRequest(const QString& jid, const QString& groupName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue