1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

[muc] Add support for muc#roomconfig_roomname in MucConfigFormManager

This commit is contained in:
Florian Schmaus 2024-05-20 15:10:56 +02:00
parent 1bf0aed0f5
commit c4ce6b4707

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2020 Florian Schmaus
* Copyright 2015-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -88,6 +88,10 @@ public class MucConfigFormManager {
*/
public static final String MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM = "muc#roomconfig_publicroom";
/**
* The constant String {@value}.
*/
public static final String MUC_ROOMCONFIG_ROOMNAME = "muc#roomconfig_roomname";
private final MultiUserChat multiUserChat;
private final FillableForm answerForm;
@ -267,6 +271,18 @@ public class MucConfigFormManager {
return this;
}
public boolean supportsRoomname() {
return answerForm.hasField(MUC_ROOMCONFIG_ROOMNAME);
}
public MucConfigFormManager setRoomName(String roomName) throws MucConfigurationNotSupportedException {
if (!supportsRoomname()) {
throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_ROOMNAME);
}
answerForm.setAnswer(MUC_ROOMCONFIG_ROOMNAME, roomName);
return this;
}
/**
* Check if the room supports password protection.
*