请问该如何解决呢?我看了spark 会先出现这个提示,然后又马上解锁了

解决方案 »

  1.   

    openfire端可以手动对聊天室的权限进行设置。
    smack端可以在申请聊天室的时候通过字段设置权限。
    至于asmack不是很清楚,应该也是有字段设置权限的。。
      

  2.   

    需要提交一个配置表单才可以解锁。try {
    MultiUserChat multiUserChat = new MultiUserChat(connection,roomid);
    multiUserChat.create("room_nickname");
    Form form;
    form = multiUserChat.getConfigurationForm();
    Form submitForm = form.createAnswerForm();
    for (Iterator<?> fields = form.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_persistentroom", true);
    submitForm.setAnswer("muc#roomconfig_membersonly", false);
    submitForm.setAnswer("muc#roomconfig_allowinvites", true);
    submitForm.setAnswer("muc#roomconfig_enablelogging", true);
    submitForm.setAnswer("x-muc#roomconfig_reservednick", true);
    submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
    submitForm.setAnswer("x-muc#roomconfig_registration", false);
    multiUserChat.sendConfigurationForm(submitForm);
    } catch (XMPPException e) {
    e.printStackTrace();
    }