diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-10-05 13:39:47 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-10-05 13:39:47 (GMT) |
commit | 16a895e7d64b71d1aa7a971d77e8daf6591e9c56 (patch) | |
tree | 9c1c71eb1a80dd0fd813ea6ba42d1d4c7d4889ed /Swiften/MUC/MUC.cpp | |
parent | 8159071adb232b68c2ce79479145fbcd04979245 (diff) | |
download | swift-contrib-16a895e7d64b71d1aa7a971d77e8daf6591e9c56.zip swift-contrib-16a895e7d64b71d1aa7a971d77e8daf6591e9c56.tar.bz2 |
Allow role changing in MUCs.
Resolves: #987
Diffstat (limited to 'Swiften/MUC/MUC.cpp')
-rw-r--r-- | Swiften/MUC/MUC.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index 15355ad..204fdcc 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -237,20 +237,25 @@ MUCOccupant MUC::getOccupant(const std::string& nick) { return occupants.find(nick)->second; } -void MUC::kickUser(const JID& jid) { +void MUC::kickOccupant(const JID& jid) { + changeOccupantRole(jid, MUCOccupant::NoRole); +} + +void MUC::changeOccupantRole(const JID& jid, MUCOccupant::Role role) { MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>(); MUCItem item; - item.role = MUCOccupant::NoRole; + item.role = role; item.nick = jid.getResource(); mucPayload->addItem(item); GenericRequest<MUCAdminPayload>* request = new GenericRequest<MUCAdminPayload>(IQ::Set, getJID(), mucPayload, iqRouter_); - request->onResponse.connect(boost::bind(&MUC::handleKickResponse, this, _1, _2, jid)); + request->onResponse.connect(boost::bind(&MUC::handleOccupantRoleChangeResponse, this, _1, _2, jid, role)); request->send(); + } -void MUC::handleKickResponse(MUCAdminPayload::ref /*unused*/, ErrorPayload::ref error, const JID& jid) { +void MUC::handleOccupantRoleChangeResponse(MUCAdminPayload::ref /*unused*/, ErrorPayload::ref error, const JID& jid, MUCOccupant::Role role) { if (error) { - onKickFailed(error, jid); + onRoleChangeFailed(error, jid, role); } } |