void VCardUpdateAvatarManager::handleStanzaChannelAvailableChanged(bool available) { if (available) { std::map<JID, std::string> oldAvatarHashes; avatarHashes_.swap(oldAvatarHashes); for(std::map<JID, std::string>::const_iterator i = oldAvatarHashes.begin(); i != oldAvatarHashes.end(); ++i) { onAvatarChanged(i->first); } } }
void CombinedAvatarProvider::handleAvatarChanged(const JID& jid) { std::string oldHash; std::map<JID, std::string>::const_iterator i = avatars.find(jid); if (i != avatars.end()) { oldHash = i->second; } boost::optional<std::string> newHash = getCombinedAvatarAndCache(jid); if (newHash != oldHash) { SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << (newHash ? newHash.get() : "NULL") << std::endl; onAvatarChanged(jid); } }
void PresenceSource::onAccountReady(Tp::PendingOperation *op) { // Check if the operation succeeded or not if (op->isError()) { kWarning() << "PresenceSource::onAccountReady: readying " "Account failed:" << op->errorName() << ":" << op->errorMessage(); return; } // Check that the account is valid if (!m_account->isValidAccount()) { // TODO should source be removed? kWarning() << "Invalid account in source:" << objectName(); return; } // set protocol icon setData("AccountIcon", m_account->iconName()); connect(m_account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)), SLOT(onAccountCurrentPresenceChanged(Tp::Presence))); connect(m_account.data(), SIGNAL(nicknameChanged(const QString &)), SLOT(onNicknameChanged(const QString &))); connect(m_account.data(), SIGNAL(displayNameChanged(const QString &)), SLOT(onDisplayNameChanged(const QString &))); connect(m_account.data(), SIGNAL(avatarChanged(const Tp::Avatar &)), SLOT(onAvatarChanged(const Tp::Avatar &))); connect(m_account.data(), SIGNAL(iconNameChanged(QString)), SLOT(onIconNameChanged(QString))); connect(m_account.data(), SIGNAL(stateChanged(bool)), SLOT(onStateChanged(bool))); // Force initial settings onAccountCurrentPresenceChanged(m_account->currentPresence()); onNicknameChanged(m_account->nickname()); onDisplayNameChanged(m_account->displayName()); onAvatarChanged(m_account->avatar()); onStateChanged(m_account->isEnabled()); }
void VCardUpdateAvatarManager::setAvatarHash(const JID& from, const std::string& hash) { SWIFT_LOG(debug) << "Updating hash: " << from << " -> " << hash << std::endl; avatarHashes_[from] = hash; onAvatarChanged(from); }
void VCardAvatarManager::handleVCardChanged(const JID& from) { // We don't check whether the avatar actually changed. Direct use of this // manager could cause unnecessary updates, but in practice, this will be // caught by the wrapping CombinedAvatarManager anyway. onAvatarChanged(from); }