summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-09-27 16:13:56 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-09-27 16:38:45 (GMT)
commit41854ebf8c3376d6ee430efe3a9fdd25610bb2f5 (patch)
tree81e918793afb16accb29af46ccd99eefa204930c /Swiften/MUC/MUC.cpp
parent24e53876500f0f5497a84b239d9350676e95751a (diff)
downloadswift-41854ebf8c3376d6ee430efe3a9fdd25610bb2f5.zip
swift-41854ebf8c3376d6ee430efe3a9fdd25610bb2f5.tar.bz2
Allow room configuration.
Resolves: #989
Diffstat (limited to 'Swiften/MUC/MUC.cpp')
-rw-r--r--Swiften/MUC/MUC.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
index 43d3f36..d4c1287 100644
--- a/Swiften/MUC/MUC.cpp
+++ b/Swiften/MUC/MUC.cpp
@@ -245,10 +245,37 @@ void MUC::changeSubject(const std::string& subject) {
}
void MUC::requestConfigurationForm() {
+ MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload());
+ GenericRequest<MUCOwnerPayload>* request = new GenericRequest<MUCOwnerPayload>(IQ::Get, getJID(), mucPayload, iqRouter_);
+ request->onResponse.connect(boost::bind(&MUC::handleConfigurationFormReceived, this, _1, _2));
+ request->send();
+}
+void MUC::handleConfigurationFormReceived(MUCOwnerPayload::ref payload, ErrorPayload::ref error) {
+ Form::ref form;
+ if (payload) {
+ form = payload->getForm();
+ }
+ if (error || !form) {
+ onConfigurationFailed(error);
+ } else {
+ onConfigurationFormReceived(form);
+ }
}
-//FIXME: Recognise Topic changes
+void MUC::handleConfigurationResultReceived(MUCOwnerPayload::ref /*payload*/, ErrorPayload::ref error) {
+ if (error) {
+ onConfigurationFailed(error);
+ }
+}
+
+void MUC::configureRoom(Form::ref form) {
+ MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload());
+ mucPayload->setPayload(form);
+ GenericRequest<MUCOwnerPayload>* request = new GenericRequest<MUCOwnerPayload>(IQ::Set, getJID(), mucPayload, iqRouter_);
+ request->onResponse.connect(boost::bind(&MUC::handleConfigurationResultReceived, this, _1, _2));
+ request->send();
+}
//TODO: Invites(direct/mediated)