forked from blue/squawk
first primitive vcard in graphic interface
This commit is contained in:
parent
c4d22c9c14
commit
2a37f36b83
13 changed files with 208 additions and 75 deletions
|
@ -344,8 +344,7 @@ void Core::Account::addedAccount(const QString& jid)
|
|||
} else {
|
||||
cData.insert("avatarState", static_cast<uint>(Shared::Avatar::empty));
|
||||
cData.insert("avatarPath", "");
|
||||
client.vCardManager().requestVCard(jid);
|
||||
pendingVCardRequests.insert(jid);
|
||||
requestVCard(jid);
|
||||
}
|
||||
int grCount = 0;
|
||||
for (QSet<QString>::const_iterator itr = gr.begin(), end = gr.end(); itr != end; ++itr) {
|
||||
|
@ -442,17 +441,14 @@ void Core::Account::onPresenceReceived(const QXmppPresence& p_presence)
|
|||
case QXmppPresence::VCardUpdateValidPhoto: //there is a photo, need to load
|
||||
if (cnt->hasAvatar()) {
|
||||
if (cnt->isAvatarAutoGenerated()) {
|
||||
client.vCardManager().requestVCard(jid);
|
||||
pendingVCardRequests.insert(jid);
|
||||
requestVCard(jid);
|
||||
} else {
|
||||
if (cnt->avatarHash() != p_presence.photoHash()) {
|
||||
client.vCardManager().requestVCard(jid);
|
||||
pendingVCardRequests.insert(jid);
|
||||
requestVCard(jid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
client.vCardManager().requestVCard(jid);
|
||||
pendingVCardRequests.insert(jid);
|
||||
requestVCard(jid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1494,3 +1490,17 @@ void Core::Account::onContactAvatarChanged(Shared::Avatar type, const QString& p
|
|||
emit changeContact(item->jid, cData);
|
||||
}
|
||||
|
||||
void Core::Account::requestVCard(const QString& jid)
|
||||
{
|
||||
if (pendingVCardRequests.find(jid) == pendingVCardRequests.end()) {
|
||||
if (jid == getLogin() + "@" + getServer()) {
|
||||
if (!ownVCardRequestInProgress) {
|
||||
client.vCardManager().requestClientVCard();
|
||||
ownVCardRequestInProgress = true;
|
||||
}
|
||||
} else {
|
||||
client.vCardManager().requestVCard(jid);
|
||||
pendingVCardRequests.insert(jid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue