summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-02-11 21:49:56 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-02-11 21:49:56 (GMT)
commit7d323757a6bbd93148fc25b94778e92c4ab3d665 (patch)
treec24e8c2d8325c17214d8ee0a2a59878732845976 /Swift/Controllers/Roster/GroupRosterItem.cpp
parent7fe127240ecebd163f65a5078f8dc927fe17e47b (diff)
downloadswift-7d323757a6bbd93148fc25b94778e92c4ab3d665.zip
swift-7d323757a6bbd93148fc25b94778e92c4ab3d665.tar.bz2
Allow group changes at the same time as nick changes.
Resolves: #696 Also hopefully Resolves: #764
Diffstat (limited to 'Swift/Controllers/Roster/GroupRosterItem.cpp')
-rw-r--r--Swift/Controllers/Roster/GroupRosterItem.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/GroupRosterItem.cpp b/Swift/Controllers/Roster/GroupRosterItem.cpp
index c473ae7..7d0cf85 100644
--- a/Swift/Controllers/Roster/GroupRosterItem.cpp
+++ b/Swift/Controllers/Roster/GroupRosterItem.cpp
@@ -110,6 +110,25 @@ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) {
return removed;
}
+GroupRosterItem* GroupRosterItem::removeGroupChild(const String& groupName) {
+ std::vector<RosterItem*>::iterator it = children_.begin();
+ GroupRosterItem* removed = NULL;
+ while (it != children_.end()) {
+ GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(*it);
+ if (group && group->getDisplayName() == groupName) {
+ displayedChildren_.erase(std::remove(displayedChildren_.begin(), displayedChildren_.end(), group), displayedChildren_.end());
+ removed = group;
+ delete group;
+ it = children_.erase(it);
+ continue;
+ }
+ it++;
+ }
+ onChildrenChanged();
+ onDataChanged();
+ return removed;
+}
+
/**
* Returns false if the list didn't need a resort
*/