summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/MUC')
-rw-r--r--Swiften/MUC/MUC.cpp13
-rw-r--r--Swiften/MUC/MUC.h5
2 files changed, 16 insertions, 2 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
index f4512a0..bcc9e6f 100644
--- a/Swiften/MUC/MUC.cpp
+++ b/Swiften/MUC/MUC.cpp
@@ -13,15 +13,18 @@
#include "Swiften/Presence/PresenceSender.h"
#include "Swiften/Client/StanzaChannel.h"
+#include "Swiften/Queries/IQRouter.h"
+#include "Swiften/Elements/Form.h"
#include "Swiften/Elements/IQ.h"
#include "Swiften/Elements/MUCUserPayload.h"
+#include "Swiften/Elements/MUCOwnerPayload.h"
#include "Swiften/Elements/MUCPayload.h"
namespace Swift {
typedef std::pair<String, MUCOccupant> StringMUCOccupantPair;
-MUC::MUC(StanzaChannel* stanzaChannel, PresenceSender* presenceSender, const JID &muc) : ownMUCJID(muc), stanzaChannel(stanzaChannel), presenceSender(presenceSender) {
+MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, PresenceSender* presenceSender, const JID &muc) : ownMUCJID(muc), stanzaChannel(stanzaChannel), iqRouter_(iqRouter), presenceSender(presenceSender), muc_(muc) {
scopedConnection_ = stanzaChannel->onPresenceReceived.connect(boost::bind(&MUC::handleIncomingPresence, this, _1));
}
@@ -134,6 +137,14 @@ void MUC::handleIncomingPresence(boost::shared_ptr<Presence> presence) {
onJoinComplete(getOwnNick());
presenceSender->addDirectedPresenceReceiver(ownMUCJID);
}
+ if (status.code == 201) {
+ /* Room is created and locked */
+ /* Currently deal with this by making an instant room */
+ boost::shared_ptr<MUCOwnerPayload> mucPayload(new MUCOwnerPayload());
+ mucPayload->setPayload(boost::shared_ptr<Payload>(new Form(Form::SubmitType)));
+ boost::shared_ptr<IQ> iq(IQ::createRequest(IQ::Set, muc_, iqRouter_->getNewIQID(), mucPayload));
+ iqRouter_->sendIQ(iq);
+ }
}
}
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index bccc26c..af3daa8 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -20,6 +20,7 @@
namespace Swift {
class StanzaChannel;
+ class IQRouter;
class PresenceSender;
class MUC {
@@ -28,7 +29,7 @@ namespace Swift {
enum LeavingType { Part, Disconnect };
public:
- MUC(StanzaChannel* stanzaChannel, PresenceSender* presenceSender, const JID &muc);
+ MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, PresenceSender* presenceSender, const JID &muc);
void joinAs(const String &nick);
/*void queryRoomInfo(); */
@@ -66,7 +67,9 @@ namespace Swift {
private:
JID ownMUCJID;
StanzaChannel* stanzaChannel;
+ IQRouter* iqRouter_;
PresenceSender* presenceSender;
+ JID muc_;
std::map<String, MUCOccupant> occupants;
bool joinComplete_;
boost::bsignals::scoped_connection scopedConnection_;