diff options
Diffstat (limited to 'Swiften/MUC/MUC.cpp')
-rw-r--r-- | Swiften/MUC/MUC.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index 08391b4..15355ad 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -38,18 +38,25 @@ MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSende /** * Join the MUC with default context. */ void MUC::joinAs(const std::string &nick) { joinSince_ = boost::posix_time::not_a_date_time; internalJoin(nick); } /** + * Set the password used for entering the room. + */ +void MUC::setPassword(const boost::optional<std::string>& newPassword) { + password = newPassword; +} + +/** * Join the MUC with context since date. */ void MUC::joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since) { joinSince_ = since; internalJoin(nick); } void MUC::internalJoin(const std::string &nick) { //TODO: password @@ -62,18 +69,21 @@ void MUC::internalJoin(const std::string &nick) { ownMUCJID = JID(ownMUCJID.getNode(), ownMUCJID.getDomain(), nick); Presence::ref joinPresence = boost::make_shared<Presence>(*presenceSender->getLastSentUndirectedPresence()); assert(joinPresence->getType() == Presence::Available); joinPresence->setTo(ownMUCJID); MUCPayload::ref mucPayload = boost::make_shared<MUCPayload>(); if (joinSince_ != boost::posix_time::not_a_date_time) { mucPayload->setSince(joinSince_); } + if (password) { + mucPayload->setPassword(*password); + } joinPresence->addPayload(mucPayload); presenceSender->sendPresence(joinPresence); } void MUC::part() { presenceSender->removeDirectedPresenceReceiver(ownMUCJID, DirectedPresenceSender::AndSendPresence); mucRegistry->removeMUC(getJID()); } |