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/RosterController.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/RosterController.cpp')
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index 2dddd7d..758d4f2 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -27,6 +27,7 @@
#include "Swift/Controllers/Roster/SetAvatar.h"
#include "Swift/Controllers/Roster/SetName.h"
#include "Swift/Controllers/Roster/OfflineRosterFilter.h"
+#include "Swift/Controllers/Roster/GroupRosterItem.h"
#include "Swiften/Roster/XMPPRoster.h"
#include "Swiften/Roster/XMPPRosterItem.h"
#include "Swift/Controllers/UIEvents/AddContactUIEvent.h"
@@ -141,7 +142,6 @@ void RosterController::handleOnJIDRemoved(const JID& jid) {
void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName, const std::vector<String> passedOldGroups) {
if (oldName != xmppRoster_->getNameForJID(jid)) {
roster_->applyOnItems(SetName(nickResolver_->jidToNick(jid), jid));
- return;
}
std::vector<String> groups = xmppRoster_->getGroupsForJID(jid);
std::vector<String> oldGroups = passedOldGroups;
@@ -161,6 +161,9 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
foreach(const String& group, oldGroups) {
if (std::find(groups.begin(), groups.end(), group) == groups.end()) {
roster_->removeContactFromGroup(jid, group);
+ if (roster_->getGroup(group)->getChildren().size() == 0) {
+ roster_->removeGroup(group);
+ }
}
}
applyAllPresenceTo(jid);