Am using the Xabber open source project and am able to create a new group, But it always says: This room is locked from entry until configuration is confirmed. I tried to set a default configuration but it throws me exception: 401 not authorized. Whats exactly the problem.
final MultiUserChat multiUserChat;
try {
multiUserChat = new MultiUserChat(xmppConnection, room);
// CHANAKYA: set default config for the MUC
// Send an empty room configuration form which indicates that we want
// an instant room
try {
multiUserChat.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
} catch (XMPPException e) {
e.printStackTrace();
}
This specification defines an XMPP protocol extension for multi-user text chat, whereby multiple XMPP users can exchange messages in the context of a room or channel, similar to Internet Relay Chat (IRC).
Added XMPP error handling; fully specified all conformance terms. Removed protocol for requesting voice in a moderated room (should be performed using Ad-Hoc Commands).
Send only the messages received since the UTC datetime specified (which MUST conform to the DateTime profile specified in XMPP Date and Time Profiles (XEP-0082) [ 17 ]). The service MUST send the smallest amount of traffic that meets any combination of the above criteria, taking into account service-level and room-level defaults.
An XMPP Server is considered secure when the following (minimum) items are present: ... Let's say you run an XMPP service for example.net (jids of [email protected]), you will need to order a certificate for with a subject or alt-name of example.net (not server.example.net) from your preferred cert provider.
I was also facing the same error. Here I modified the code and it's work for me. Error 401 is not authorized error when we are calling the any getConfigurationForm(), without joining it.
multiUserChat.join(nickname, password);
setConfig(multiUserChat); // Here I am calling submit form
private void setConfig(MultiUserChat multiUserChat) {
try {
Form form = multiUserChat.getConfigurationForm();
Form submitForm = form.createAnswerForm();
for (Iterator<FormField> fields = submitForm.getFields(); fields
.hasNext();) {
FormField field = (FormField) fields.next();
if (!FormField.Type.hidden.equals(field.getType())
&& field.getVariable() != null) {
submitForm.setDefaultAnswer(field.getVariable());
}
}
submitForm.setAnswer("muc#roomconfig_publicroom", true);
submitForm.setAnswer("muc#roomconfig_persistentroom", true);
multiUserChat.sendConfigurationForm(submitForm);
} catch (Exception e) {
e.printStackTrace();
}
}
And now I am able to successfully submit the form without any exception. Hope this will work for you.
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