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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ void Core::Squawk::addAccount(const QString& login, const QString& server, const
|
|||
connect(acc, &Account::changeRoomParticipant, this, &Squawk::onAccountChangeRoomPresence);
|
||||
connect(acc, &Account::removeRoomParticipant, this, &Squawk::onAccountRemoveRoomPresence);
|
||||
|
||||
connect(acc, &Account::receivedVCard, this, &Squawk::responseVCard);
|
||||
|
||||
QMap<QString, QVariant> map = {
|
||||
{"login", login},
|
||||
|
@ -507,7 +508,7 @@ void Core::Squawk::addContactToGroupRequest(const QString& account, const QStrin
|
|||
{
|
||||
AccountsMap::const_iterator itr = amap.find(account);
|
||||
if (itr == amap.end()) {
|
||||
qDebug() << "An attempt to add contact" << jid << "of existing account" << account << "to the group" << groupName << ", skipping";
|
||||
qDebug() << "An attempt to add contact" << jid << "of non existing account" << account << "to the group" << groupName << ", skipping";
|
||||
return;
|
||||
}
|
||||
itr->second->addContactToGroupRequest(jid, groupName);
|
||||
|
@ -517,7 +518,7 @@ void Core::Squawk::removeContactFromGroupRequest(const QString& account, const Q
|
|||
{
|
||||
AccountsMap::const_iterator itr = amap.find(account);
|
||||
if (itr == amap.end()) {
|
||||
qDebug() << "An attempt to add contact" << jid << "of existing account" << account << "to the group" << groupName << ", skipping";
|
||||
qDebug() << "An attempt to add contact" << jid << "of non existing account" << account << "to the group" << groupName << ", skipping";
|
||||
return;
|
||||
}
|
||||
itr->second->removeContactFromGroupRequest(jid, groupName);
|
||||
|
@ -527,8 +528,18 @@ void Core::Squawk::renameContactRequest(const QString& account, const QString& j
|
|||
{
|
||||
AccountsMap::const_iterator itr = amap.find(account);
|
||||
if (itr == amap.end()) {
|
||||
qDebug() << "An attempt to rename contact" << jid << "of existing account" << account << ", skipping";
|
||||
qDebug() << "An attempt to rename contact" << jid << "of non existing account" << account << ", skipping";
|
||||
return;
|
||||
}
|
||||
itr->second->renameContactRequest(jid, newName);
|
||||
}
|
||||
|
||||
void Core::Squawk::requestVCard(const QString& account, const QString& jid)
|
||||
{
|
||||
AccountsMap::const_iterator itr = amap.find(account);
|
||||
if (itr == amap.end()) {
|
||||
qDebug() << "An attempt to request" << jid << "vcard of non existing account" << account << ", skipping";
|
||||
return;
|
||||
}
|
||||
itr->second->requestVCard(jid);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ signals:
|
|||
void fileLocalPathResponse(const QString& messageId, const QString& path);
|
||||
void downloadFileError(const QString& messageId, const QString& error);
|
||||
void downloadFileProgress(const QString& messageId, qreal value);
|
||||
void responseVCard(const QString& jid, const Shared::VCard& card);
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
|
@ -91,6 +92,7 @@ public slots:
|
|||
void removeRoomRequest(const QString& account, const QString& jid);
|
||||
void fileLocalPathRequest(const QString& messageId, const QString& url);
|
||||
void downloadFileRequest(const QString& messageId, const QString& url);
|
||||
void requestVCard(const QString& account, const QString& jid);
|
||||
|
||||
private:
|
||||
typedef std::deque<Account*> Accounts;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue