From 1d498efd46308f5957f688fcd958fb812101c618 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 May 2024 22:05:17 +0200 Subject: [PATCH] [muc] Add support for muc#roomconfig_enablelogging to MucConfigFormManager --- .../smackx/muc/MucConfigFormManager.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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 7eff69fa0..9f2778e9c 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 @@ -93,6 +93,11 @@ public class MucConfigFormManager { */ public static final String MUC_ROOMCONFIG_ROOMNAME = "muc#roomconfig_roomname"; + /** + * The constant String {@value}. + */ + public static final String MUC_ROOMCONFIG_ENABLE_PUBLIC_LOGGING = "muc#roomconfig_enablelogging"; + private final MultiUserChat multiUserChat; private final FillableForm answerForm; private final List owners; @@ -331,6 +336,26 @@ public class MucConfigFormManager { return this; } + public boolean supportsPublicLogging() { + return answerForm.hasField(MUC_ROOMCONFIG_ENABLE_PUBLIC_LOGGING); + } + + public MucConfigFormManager setPublicLogging(boolean enabled) throws MucConfigurationNotSupportedException { + if (!supportsPublicLogging()) { + throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_ENABLE_PUBLIC_LOGGING); + } + answerForm.setAnswer(MUC_ROOMCONFIG_ENABLE_PUBLIC_LOGGING, enabled); + return this; + } + + public MucConfigFormManager enablePublicLogging() throws MucConfigurationNotSupportedException { + return setPublicLogging(true); + } + + public MucConfigFormManager disablPublicLogging() throws MucConfigurationNotSupportedException { + return setPublicLogging(false); + } + /** * Set the room secret, aka the room password. If set and enabled, the password is required to * join the room. Note that this does only set it by does not enable password protection. Use