Question

I'm creating a new multiUserChat room successfully and adding users to this room but when the users go offline they leave the room how can I keep the user in the room permanently I searched the Room config in openfire and no such option please help and if not possible what is the best way to make a permanent groupchat (e.g. whatapp grroup)??? here is the code I'm using

 MultiUserChat muc = new MultiUserChat(MyApplication.connection, room);

      // Create the room
      SmackConfiguration.setPacketReplyTimeout(2000);
      muc.create("testGroup2s2");

      // Get the the room's configuration form
      Form form = muc.getConfigurationForm();
      // Create a new form to submit based on the original form
      Form submitForm = form.createAnswerForm();
      // Add default answers to the form to submit
      for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
          FormField field = (FormField) fields.next();

          if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) {
              // Sets the default value as the answer
              submitForm.setDefaultAnswer(field.getVariable());
          }
      }
      // Sets the new owner of the room
      List<String> owners = new ArrayList<String>();
      owners.add(MyApplication.connection.getUser() );
      submitForm.setAnswer("muc#roomconfig_roomowners", owners);


        muc.sendConfigurationForm(submitForm);
Was it helpful?

Solution

The XMPP MUC protocol does not support such a thing. Once the full JID that joined the room, (or the bare JID, in case the MUC component supports joining a MUC from multiple resources of a JID) goes offline, the JID will also leave the MUC.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top