summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-05 07:34:05 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-05 07:34:05 (GMT)
commit3e972565e51f5b2fa7e9768d5d84a7d4b6dfc09b (patch)
treeb5b464804d169396f0cdd7348f4ae600ee2efe33 /Swiften/MUC
parent1f4be30a480818458fd841809585681597be831e (diff)
downloadswift-contrib-3e972565e51f5b2fa7e9768d5d84a7d4b6dfc09b.zip
swift-contrib-3e972565e51f5b2fa7e9768d5d84a7d4b6dfc09b.tar.bz2
Allow joining passworded MUCs.
Resolves: #991
Diffstat (limited to 'Swiften/MUC')
-rw-r--r--Swiften/MUC/MUC.cpp10
-rw-r--r--Swiften/MUC/MUC.h2
-rw-r--r--Swiften/MUC/MUCBookmark.h3
3 files changed, 14 insertions, 1 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
@@ -44,6 +44,13 @@ void MUC::joinAs(const std::string &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) {
@@ -68,6 +75,9 @@ void MUC::internalJoin(const std::string &nick) {
if (joinSince_ != boost::posix_time::not_a_date_time) {
mucPayload->setSince(joinSince_);
}
+ if (password) {
+ mucPayload->setPassword(*password);
+ }
joinPresence->addPayload(mucPayload);
presenceSender->sendPresence(joinPresence);
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index adc5707..a9b42b8 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -65,6 +65,7 @@ namespace Swift {
/** Send an invite for the person to join the MUC */
void invitePerson(const JID& person, const std::string& reason = "");
void setCreateAsReservedIfNew() {createAsReservedIfNew = true;}
+ void setPassword(const boost::optional<std::string>& password);
public:
boost::signal<void (const std::string& /*nick*/)> onJoinComplete;
boost::signal<void (ErrorPayload::ref)> onJoinFailed;
@@ -110,5 +111,6 @@ namespace Swift {
boost::posix_time::ptime joinSince_;
bool createAsReservedIfNew;
bool unlocking;
+ boost::optional<std::string> password;
};
}
diff --git a/Swiften/MUC/MUCBookmark.h b/Swiften/MUC/MUCBookmark.h
index 3f612c4..3c28bdb 100644
--- a/Swiften/MUC/MUCBookmark.h
+++ b/Swiften/MUC/MUCBookmark.h
@@ -59,7 +59,8 @@ namespace Swift {
}
bool operator==(const MUCBookmark& rhs) const {
- return rhs.room_ == room_ && rhs.name_ == name_ && rhs.nick_ == nick_ && rhs.password_ == password_ && rhs.autojoin_ == autojoin_;
+ /* FIXME: not checking passwords for equality - which might make sense, perhaps */
+ return rhs.room_ == room_ && rhs.name_ == name_ && rhs.nick_ == nick_ /*&& rhs.password_ == password_*/ && rhs.autojoin_ == autojoin_;
}
Storage::Room toStorage() const {