Store buddy changes only when there's a real change
This commit is contained in:
parent
3f7677176b
commit
afe5ac506d
3 changed files with 12 additions and 6 deletions
|
@ -51,10 +51,20 @@ class LocalBuddy : public Buddy {
|
|||
}
|
||||
|
||||
std::string getIconHash() { return m_iconHash; }
|
||||
void setIconHash(const std::string &iconHash) { m_iconHash = iconHash; }
|
||||
void setIconHash(const std::string &iconHash) {
|
||||
bool changed = m_iconHash != iconHash;
|
||||
m_iconHash = iconHash;
|
||||
if (changed)
|
||||
getRosterManager()->storeBuddy(this);
|
||||
}
|
||||
|
||||
std::vector<std::string> getGroups() { return m_groups; }
|
||||
void setGroups(const std::vector<std::string> &groups) { m_groups = groups; }
|
||||
void setGroups(const std::vector<std::string> &groups) {
|
||||
bool changed = m_groups.size() != groups.size();
|
||||
m_groups = groups;
|
||||
if (changed)
|
||||
getRosterManager()->storeBuddy(this);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
|
|
|
@ -148,7 +148,6 @@ void Buddy::handleBuddyChanged() {
|
|||
if (presence) {
|
||||
m_rosterManager->getUser()->getComponent()->getStanzaChannel()->sendPresence(presence);
|
||||
}
|
||||
m_rosterManager->handleBuddyChanged(this);
|
||||
}
|
||||
|
||||
void Buddy::handleVCardReceived(const std::string &id, Swift::VCard::ref vcard) {
|
||||
|
|
|
@ -152,9 +152,6 @@ void RosterManager::sendBuddySubscribePresence(Buddy *buddy) {
|
|||
}
|
||||
|
||||
void RosterManager::handleBuddyChanged(Buddy *buddy) {
|
||||
if (m_rosterStorage) {
|
||||
m_rosterStorage->storeBuddy(buddy);
|
||||
}
|
||||
}
|
||||
|
||||
void RosterManager::setBuddyCallback(Buddy *buddy) {
|
||||
|
|
Loading…
Add table
Reference in a new issue