diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-02-11 21:49:56 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-02-11 21:49:56 (GMT) |
commit | 7d323757a6bbd93148fc25b94778e92c4ab3d665 (patch) | |
tree | c24e8c2d8325c17214d8ee0a2a59878732845976 /Swift/Controllers/Roster/RosterController.cpp | |
parent | 7fe127240ecebd163f65a5078f8dc927fe17e47b (diff) | |
download | swift-contrib-7d323757a6bbd93148fc25b94778e92c4ab3d665.zip swift-contrib-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.cpp | 5 |
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); |