When I try to create a room in Multi User Chat (MUC) the server responds 'This room is locked from entry until configuration is confirmed'. How can I overcome this?
Thanks in advance
You need to send a configuration form for the room. If you are using smack the code would look something like this:
Form submitForm = multiUserChat.getConfigurationForm().createAnswerForm();
submitForm.setAnswer("muc#roomconfig_publicroom", false);
submitForm.setAnswer("muc#roomconfig_roomname", room);
multiUserChat.sendConfigurationForm(submitForm);
I was having this problem using Candy Chat 1.7.1 with Openfire 3.9.3.
This took me a while to work out, but after reading through the Multi-User Chat spec: http://xmpp.org/extensions/xep-0045.html#createroom
I eventually solved it; first with Strophe, then from that found the Candy way.
So to answer your question:
After creating the room by sending the presence (Example 153 in spec)
I sent the below (as per Example 155 in spec)
conn.sendIQ($iq({
type: "set",
to: escapedRoomId,
from: me.getEscapedJid(),
id: "create:" + conn.getUniqueId()
}).c("query", {
xmlns: "http://jabber.org/protocol/muc#owner"
}).c("x", {
xmlns: "jabber:x:data",
type: "submit"
}));
where conn is the Strophe.Connection
Then to help others who may have the same problem in Candy Chat:
After searching for bits of the Strophe message above in the candy libs bundle I found this:
createInstantRoom: function(room, success_cb, error_cb) {
var roomiq;
roomiq = $iq({
to: room,
type: "set"
}).c("query", {
xmlns: Strophe.NS.MUC_OWNER
}).c("x", {
xmlns: "jabber:x:data",
type: "submit"
});
return this._connection.sendIQ(roomiq.tree(), success_cb, error_cb);
},
So then this solves it in Candy Chat.
$(Candy).on('candy:view.room.after-add', function(evt, args) {
Candy.Core.getConnection().muc.createInstantRoom(Candy.Util.escapeJid(args.roomJid));
});
Irritatingly simple when you know how. Incidentally I think the method should be called configureAsInstantRoom and Candy chat should have an option for this on the init method or similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With