summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-07-23 14:47:48 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-07-23 15:01:33 (GMT)
commit4cc96003c6702168da2faa955e3c771272211e32 (patch)
treeb15355b09676583b2fb468f616f3dd284c52eac9 /Swiften/Roster/GroupRosterItem.cpp
parente00480d2f4326decd23ff7665fcb1af5e752c8ec (diff)
downloadswift-4cc96003c6702168da2faa955e3c771272211e32.zip
swift-4cc96003c6702168da2faa955e3c771272211e32.tar.bz2
Recognise when leaving a MUC (disconnect or kick).
Also cleans up some outstanding MUC issues. Resolves: #288 Resolves: #392 Resolves: #279 Resolves: #114
Diffstat (limited to 'Swiften/Roster/GroupRosterItem.cpp')
-rw-r--r--Swiften/Roster/GroupRosterItem.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Swiften/Roster/GroupRosterItem.cpp b/Swiften/Roster/GroupRosterItem.cpp
index e5490e2..8e4be35 100644
--- a/Swiften/Roster/GroupRosterItem.cpp
+++ b/Swiften/Roster/GroupRosterItem.cpp
@@ -55,6 +55,27 @@ void GroupRosterItem::addChild(RosterItem* item) {
}
/**
+ * Does not emit a changed signal.
+ */
+void GroupRosterItem::removeAll() {
+ std::vector<RosterItem*>::iterator it = children_.begin();
+ displayedChildren_.clear();
+ while (it != children_.end()) {
+ ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(*it);
+ if (contact) {
+ delete contact;
+ }
+ GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(*it);
+ if (group) {
+ group->removeAll();
+ delete group;
+ }
+ it++;
+ }
+ children_.clear();
+}
+
+/**
* Returns the removed item - but only if it's the only one, otherwise
* the return result is undefined.
*/