Default configuration for xmpp for Android xmpp

I am using an open source Xabber project and I can create a new group, but it always says: this room is locked from writing to confirming the configuration. I tried to set the default configuration, but that robs me of an exception: 401 is not authorized. What is 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(); } 
+7
source share
2 answers

I also encountered the same error. Here I changed the code and it works for me. Error 401 is not an authorized error when we call 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 can successfully submit the form without any exceptions. Hope this works for you.

+7
source

You must have permissions to configure. This can usually be changed in the server settings. If you have Openfire, you should go to Group Chat > Group chat settings > Click Group Chat > Room Creation Permissions or Administrators .

You may be unable to change this client side, this is only possible if you have access to the server to which you are trying to connect.

0
source

All Articles