Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public class MucConfigFormManager {
*/
public static final String MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM = "muc#roomconfig_passwordprotectedroom";

/**
* Whether to Make Room Persistent on a server.
* Type: boolean
*/
public static final String MUC_ROOMCONFIG_PERSISTENTROOM = "muc#roomconfig_persistentroom";

/**
* The constant String {@value}.
*/
Expand All @@ -102,6 +108,12 @@ public class MucConfigFormManager {
*/
public static final String MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM = "muc#roomconfig_publicroom";

/**
* Short Description of Room.
* Type: text-single
*/
public static final String MUC_ROOMCONFIG_ROOMDESC = "muc#roomconfig_roomdesc";

/**
* The constant String {@value}.
*/
Expand Down Expand Up @@ -338,6 +350,26 @@ public MucConfigFormManager setPublic(boolean isPublic) throws MucConfigurationN
return this;
}

public boolean supportsPersistent() {
return answerForm.hasField(MUC_ROOMCONFIG_PERSISTENTROOM);
}

/**
* Set if the room is persistent.
* Such a room is not destroyed if the last occupant exits, unlike Temporary Room.
*
* @param isPersistent if the room should be persistent.
* @return a reference to this object.
* @throws MucConfigurationNotSupportedException if the requested MUC configuration is not supported by the MUC service.
*/
public MucConfigFormManager setPersistent(boolean isPersistent) throws MucConfigurationNotSupportedException {
if (!supportsPersistent()) {
throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_PERSISTENTROOM);
}
answerForm.setAnswer(MUC_ROOMCONFIG_PERSISTENTROOM, isPersistent);
return this;
}

public boolean supportsRoomname() {
return answerForm.hasField(MUC_ROOMCONFIG_ROOMNAME);
}
Expand All @@ -350,6 +382,18 @@ public MucConfigFormManager setRoomName(String roomName) throws MucConfiguration
return this;
}

public boolean supportsRoomDescription() {
return answerForm.hasField(MUC_ROOMCONFIG_ROOMDESC);
}

public MucConfigFormManager setRoomDescription(String roomDescription) throws MucConfigurationNotSupportedException {
if (!supportsRoomDescription()) {
throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_ROOMDESC);
}
answerForm.setAnswer(MUC_ROOMCONFIG_ROOMDESC, roomDescription);
return this;
}

/**
* Check if the room supports password protection.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,21 @@ public void mucTestChangeRoomName() throws XmppStringprepException, MucAlreadyJo
createMuc(mucAsSeenByOne, nicknameOne);
try {
String initialRoomName = "Initial Room Name";
mucAsSeenByOne.getConfigFormManager().setRoomName(initialRoomName).submitConfigurationForm();
mucAsSeenByOne.getConfigFormManager()
.setRoomName(initialRoomName)
.setRoomDescription(initialRoomName)
.submitConfigurationForm();
RoomInfo roomInfo = mucManagerOne.getRoomInfo(mucAddress);
assertEquals(initialRoomName, roomInfo.getName());

String newRoomName = "New Room Name";
mucAsSeenByOne.getConfigFormManager().setRoomName(newRoomName).submitConfigurationForm();
mucAsSeenByOne.getConfigFormManager()
.setRoomName(newRoomName)
.setRoomDescription(newRoomName)
.submitConfigurationForm();
roomInfo = mucManagerOne.getRoomInfo(mucAddress);
assertEquals(newRoomName, roomInfo.getName());
assertEquals(newRoomName, roomInfo.getDescription());
} catch (MucConfigurationNotSupportedException e) {
throw new TestNotPossibleException(e);
} finally {
Expand Down