send roster push on group change
This commit is contained in:
parent
cea442358b
commit
ee4e5ecb71
2 changed files with 21 additions and 6 deletions
|
@ -59,12 +59,7 @@ class LocalBuddy : public Buddy {
|
|||
}
|
||||
|
||||
std::vector<std::string> getGroups() { return m_groups; }
|
||||
void setGroups(const std::vector<std::string> &groups) {
|
||||
bool changed = m_groups.size() != groups.size();
|
||||
m_groups = groups;
|
||||
if (changed)
|
||||
getRosterManager()->storeBuddy(this);
|
||||
}
|
||||
void setGroups(const std::vector<std::string> &groups);
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
|
|
|
@ -48,4 +48,24 @@ void LocalBuddy::setAlias(const std::string &alias) {
|
|||
}
|
||||
}
|
||||
|
||||
void LocalBuddy::setGroups(const std::vector<std::string> &groups) {
|
||||
bool changed = m_groups.size() != groups.size();
|
||||
if (!changed) {
|
||||
for (int i = 0; i != m_groups.size(); i++) {
|
||||
if (m_groups[i] != groups[i]) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_groups = groups;
|
||||
if (changed) {
|
||||
if (getRosterManager()->getUser()->getComponent()->inServerMode() || getRosterManager()->isRemoteRosterSupported()) {
|
||||
getRosterManager()->sendBuddyRosterPush(this);
|
||||
}
|
||||
getRosterManager()->storeBuddy(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue