summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-18 14:27:12 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-18 14:27:22 (GMT)
commitc1663b9b935eeeef87fb242e09efc48a1b1b5dca (patch)
treef555695d29277447efd49b2c11979f8e7540d60a /Swift
parentcc3828e7f77074064f92ddf306765da0780fa823 (diff)
downloadswift-c1663b9b935eeeef87fb242e09efc48a1b1b5dca.zip
swift-c1663b9b935eeeef87fb242e09efc48a1b1b5dca.tar.bz2
When changing affiliation, only send the new one.
Previously removing from admin and adding to members would send both none and member, causing people to be ejected from members-only rooms. Resolves: #1016
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 30e85ad..6d3f9f2 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -645,8 +645,16 @@ void MUCController::handleGetAffiliationsRequest() {
typedef std::pair<MUCOccupant::Affiliation, JID> AffiliationChangePair;
void MUCController::handleChangeAffiliationsRequest(const std::vector<std::pair<MUCOccupant::Affiliation, JID> >& changes) {
+ std::set<JID> addedJIDs;
foreach (const AffiliationChangePair& change, changes) {
- muc_->changeAffiliation(change.second, change.first);
+ if (change.first != MUCOccupant::NoAffiliation) {
+ addedJIDs.insert(change.second);
+ }
+ }
+ foreach (const AffiliationChangePair& change, changes) {
+ if (change.first != MUCOccupant::NoAffiliation || addedJIDs.find(change.second) == addedJIDs.end()) {
+ muc_->changeAffiliation(change.second, change.first);
+ }
}
}