muc participant avatars
This commit is contained in:
parent
efc90e18c3
commit
55703c2007
15 changed files with 506 additions and 221 deletions
|
@ -68,3 +68,33 @@ void Core::Contact::setSubscriptionState(Shared::SubscriptionState state)
|
|||
emit subscriptionStateChanged(subscriptionState);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Contact::handlePresence(const QXmppPresence& pres)
|
||||
{
|
||||
switch (pres.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
|
||||
Archive::AvatarInfo info;
|
||||
bool hasAvatar = readAvatarInfo(info);
|
||||
if (!hasAvatar || !info.autogenerated) {
|
||||
setAutoGeneratedAvatar();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QXmppPresence::VCardUpdateValidPhoto:{ //there is a photo, need to load
|
||||
Archive::AvatarInfo info;
|
||||
bool hasAvatar = readAvatarInfo(info);
|
||||
if (hasAvatar) {
|
||||
if (info.autogenerated || info.hash != pres.photoHash()) {
|
||||
emit requestVCard(jid);
|
||||
}
|
||||
} else {
|
||||
emit requestVCard(jid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue