1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

[muc] Add support for muc#roomconfig_enablelogging to MucConfigFormManager

This commit is contained in:
Florian Schmaus 2024-05-20 22:05:17 +02:00
parent 90c7dc4390
commit 1d498efd46

View file

@ -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<Jid> 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