I've created a login connection succesfully for XMPP with Smack Api(4.1.4). Now i'm trying to create MultiUserChat using,
try {
String myMUCName = "TestGroup";
String myMUCService = "conference.(my local ip)";
String myMUCfullName = myMUCName + "@" + myMUCService;
String userName = "Test5";
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
MultiUserChat muc = manager.getMultiUserChat(myMUCfullName);
muc.create(userName);
Log.d(LOCAL_TAG, "createGroupChat -- Group CEATED Successfully ");
Form form = muc.getConfigurationForm();
Form submitForm = form.createAnswerForm();
List<FormField> fields = form.getFields();
Log.d(LOCAL_TAG, "createGroupChat -- fields.size(): "+fields.size());
for (int i = 0; i < fields.size(); i++) {
FormField field = (FormField) fields.get(i);
if (!FormField.Type.hidden.equals(field.getType()) && field.getVariable() != null) {
submitForm.setDefaultAnswer(field.getVariable());
}
}
List owners = new ArrayList();
owners.add(userName); //Own user
owners.add("Test7"); //Another user
submitForm.setAnswer("muc#roomconfig_roomowners", owners);
submitForm.setAnswer("muc#roomconfig_publicroom", true);
submitForm.setAnswer("muc#roomconfig_persistentroom", true);
muc.sendConfigurationForm(new Form(DataForm.Type.submit));
//muc.sendConfigurationForm(submitForm);
Log.d(LOCAL_TAG, "createGroupChat -- Sent Configuration");
muc.join(TestGroup);
Log.d(LOCAL_TAG, "createGroupChat -- Group Joined Successfully -- owners.size(): "+owners.size());
But while creating the group i'm getting an exception as
"org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: forbidden - auth".
Hope so, this exception occurs at the code
muc.sendConfigurationForm(submitForm);
which is commented in this for that reason. Because i didn't get the log after that code. To fix that, I have changed that code to
muc.sendConfigurationForm(new Form(DataForm.Type.submit));
which fixes that exception and created me a group, because i could see the log as printed and can see my group in the open fire. But i do know how my selected users for the group gets added, by doing like this, since owners list(or submit form) is not included in this at anywhere. I don't know what's happening in this and I'm not sure that i'm doing right. Plz suggest me to how to proceed. Thanks in advance.