diff options
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 16 | ||||
-rw-r--r-- | Swiften/MUC/MUC.cpp | 2 | ||||
-rw-r--r-- | Swiften/MUC/MUC.h | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 6d3f9f2..1120f4b 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -120,24 +120,30 @@ void MUCController::handleWindowOccupantSelectionChanged(ContactRosterItem* item actions.push_back(ChatWindow::Ban); actions.push_back(ChatWindow::MakeModerator); actions.push_back(ChatWindow::MakeParticipant); actions.push_back(ChatWindow::MakeVisitor); } chatWindow_->setAvailableOccupantActions(actions); } void MUCController::handleActionRequestedOnOccupant(ChatWindow::OccupantAction action, ContactRosterItem* item) { + JID mucJID = item->getJID(); + MUCOccupant occupant = muc_->getOccupant(mucJID.getResource()); + JID realJID; + if (occupant.getRealJID()) { + realJID = occupant.getRealJID().get(); + } switch (action) { - case ChatWindow::Kick: muc_->kickOccupant(item->getJID());break; - case ChatWindow::Ban: muc_->changeAffiliation(item->getJID(), MUCOccupant::Outcast);break; - case ChatWindow::MakeModerator: muc_->changeOccupantRole(item->getJID(), MUCOccupant::Moderator);break; - case ChatWindow::MakeParticipant: muc_->changeOccupantRole(item->getJID(), MUCOccupant::Participant);break; - case ChatWindow::MakeVisitor: muc_->changeOccupantRole(item->getJID(), MUCOccupant::Visitor);break; + case ChatWindow::Kick: muc_->kickOccupant(mucJID);break; + case ChatWindow::Ban: muc_->changeAffiliation(realJID, MUCOccupant::Outcast);break; + case ChatWindow::MakeModerator: muc_->changeOccupantRole(mucJID, MUCOccupant::Moderator);break; + case ChatWindow::MakeParticipant: muc_->changeOccupantRole(mucJID, MUCOccupant::Participant);break; + case ChatWindow::MakeVisitor: muc_->changeOccupantRole(mucJID, MUCOccupant::Visitor);break; } } void MUCController::handleBareJIDCapsChanged(const JID& /*jid*/) { ChatWindow::Tristate support = ChatWindow::Yes; bool any = false; foreach (const std::string& nick, currentOccupants_) { DiscoInfo::ref disco = entityCapsProvider_->getCaps(toJID_.toBare().toString() + "/" + nick); if (disco && disco->hasFeature(DiscoInfo::MessageCorrectionFeature)) { diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index 824ced1..78546c8 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -227,19 +227,19 @@ void MUC::handleCreationConfigResponse(MUCOwnerPayload::ref /*unused*/, ErrorPay } else { onJoinComplete(getOwnNick()); /* Previously, this wasn't needed here, as the presence duplication bug caused an emit elsewhere. */ } } bool MUC::hasOccupant(const std::string& nick) { return occupants.find(nick) != occupants.end(); } -MUCOccupant MUC::getOccupant(const std::string& nick) { +const MUCOccupant& MUC::getOccupant(const std::string& nick) { return occupants.find(nick)->second; } void MUC::kickOccupant(const JID& jid) { changeOccupantRole(jid, MUCOccupant::NoRole); } /** * Call with the room JID, not the real JID. diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h index 1070c69..39acb22 100644 --- a/Swiften/MUC/MUC.h +++ b/Swiften/MUC/MUC.h @@ -48,19 +48,19 @@ namespace Swift { void joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since); /*void queryRoomInfo(); */ /*void queryRoomItems(); */ std::string getCurrentNick(); void part(); void handleIncomingMessage(Message::ref message); /** Expose public so it can be called when e.g. user goes offline */ void handleUserLeft(LeavingType); /** Get occupant information*/ - MUCOccupant getOccupant(const std::string& nick); + const MUCOccupant& getOccupant(const std::string& nick); bool hasOccupant(const std::string& nick); void kickOccupant(const JID& jid); void changeOccupantRole(const JID& jid, MUCOccupant::Role role); void requestAffiliationList(MUCOccupant::Affiliation); void changeAffiliation(const JID& jid, MUCOccupant::Affiliation affiliation); void changeSubject(const std::string& subject); void requestConfigurationForm(); void configureRoom(Form::ref); void cancelConfigureRoom(); |