some lines to vCard object
This commit is contained in:
parent
46e74ad5e8
commit
d050cd82dd
4 changed files with 153 additions and 0 deletions
|
@ -1341,6 +1341,7 @@ void Core::Account::onVCardReceived(const QXmppVCardIq& card)
|
|||
if (confItr == conferences.end()) {
|
||||
if (jid == getLogin() + "@" + getServer()) {
|
||||
onOwnVCardReceived(card);
|
||||
|
||||
} else {
|
||||
qDebug() << "received vCard" << jid << "doesn't belong to any of known contacts or conferences, skipping";
|
||||
}
|
||||
|
@ -1353,11 +1354,32 @@ void Core::Account::onVCardReceived(const QXmppVCardIq& card)
|
|||
}
|
||||
|
||||
QByteArray ava = card.photo();
|
||||
|
||||
if (ava.size() > 0) {
|
||||
item->setAvatar(ava);
|
||||
} else {
|
||||
item->setAutoGeneratedAvatar();
|
||||
}
|
||||
|
||||
Shared::VCard vCard;
|
||||
vCard.setFirstName(card.firstName());
|
||||
vCard.setMiddleName(card.middleName());
|
||||
vCard.setLastName(card.lastName());
|
||||
vCard.setBirthday(card.birthday());
|
||||
vCard.setNickName(card.nickName());
|
||||
vCard.setDescription(card.description());
|
||||
if (item->hasAvatar()) {
|
||||
if (item->isAvatarAutoGenerated()) {
|
||||
vCard.setAvatarType(Shared::Avatar::valid);
|
||||
} else {
|
||||
vCard.setAvatarType(Shared::Avatar::autocreated);
|
||||
}
|
||||
vCard.setAvatarPath(item->avatarPath());
|
||||
} else {
|
||||
vCard.setAvatarType(Shared::Avatar::empty);
|
||||
}
|
||||
|
||||
emit receivedVCard(jid, vCard);
|
||||
}
|
||||
|
||||
void Core::Account::onOwnVCardReceived(const QXmppVCardIq& card)
|
||||
|
@ -1438,6 +1460,22 @@ void Core::Account::onOwnVCardReceived(const QXmppVCardIq& card)
|
|||
}
|
||||
|
||||
ownVCardRequestInProgress = false;
|
||||
|
||||
Shared::VCard vCard;
|
||||
vCard.setFirstName(card.firstName());
|
||||
vCard.setMiddleName(card.middleName());
|
||||
vCard.setLastName(card.lastName());
|
||||
vCard.setBirthday(card.birthday());
|
||||
vCard.setNickName(card.nickName());
|
||||
vCard.setDescription(card.description());
|
||||
if (avatarType.size() > 0) {
|
||||
vCard.setAvatarType(Shared::Avatar::valid);
|
||||
vCard.setAvatarPath(path + "avatar." + avatarType);
|
||||
} else {
|
||||
vCard.setAvatarType(Shared::Avatar::empty);
|
||||
}
|
||||
|
||||
emit receivedVCard(getLogin() + "@" + getServer(), vCard);
|
||||
}
|
||||
|
||||
QString Core::Account::getAvatarPath() const
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
void setRoomAutoJoin(const QString& jid, bool joined);
|
||||
void removeRoomRequest(const QString& jid);
|
||||
void addRoomRequest(const QString& jid, const QString& nick, const QString& password, bool autoJoin);
|
||||
void requestVCard(const QString& jid);
|
||||
|
||||
signals:
|
||||
void changed(const QMap<QString, QVariant>& data);
|
||||
|
@ -109,6 +110,7 @@ signals:
|
|||
void addRoomParticipant(const QString& jid, const QString& nickName, const QMap<QString, QVariant>& data);
|
||||
void changeRoomParticipant(const QString& jid, const QString& nickName, const QMap<QString, QVariant>& data);
|
||||
void removeRoomParticipant(const QString& jid, const QString& nickName);
|
||||
void receivedVCard(const QString& jid, const Shared::VCard& card);
|
||||
|
||||
private:
|
||||
QString name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue