From c4ce6b470795b764e8a2bcaf562ac8e9a2129bf2 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 May 2024 15:10:56 +0200 Subject: [PATCH] [muc] Add support for muc#roomconfig_roomname in MucConfigFormManager --- .../smackx/muc/MucConfigFormManager.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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. *