diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MucConfigFormManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MucConfigFormManager.java index 80371f7c8..7eff69fa0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MucConfigFormManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MucConfigFormManager.java @@ -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. *