1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 00:59:39 +02:00

[sinttest] Additional tests for s7 of XEP-0045

This commit is contained in:
Dan Caseley 2021-06-17 18:40:45 +01:00 committed by Guus der Kinderen
parent 2e94599d58
commit 855f01e6b2
8 changed files with 1393 additions and 72 deletions

View file

@ -223,6 +223,15 @@ public class MucConfigFormManager {
}
/**
* Check if the room supports its visibility being controlled vioa configuration.
*
* @return <code>true</code> if supported, <code>false</code> if not.
*/
public boolean supportsPublicRoom() {
return answerForm.hasField(MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM);
}
/**
* Make the room publicly searchable.
*
@ -251,7 +260,7 @@ public class MucConfigFormManager {
* @throws MucConfigurationNotSupportedException if the requested MUC configuration is not supported by the MUC service.
*/
public MucConfigFormManager setPublic(boolean isPublic) throws MucConfigurationNotSupportedException {
if (!supportsModeration()) {
if (!supportsPublicRoom()) {
throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM);
}
answerForm.setAnswer(MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM, isPublic);
@ -299,7 +308,7 @@ public class MucConfigFormManager {
*/
public MucConfigFormManager setIsPasswordProtected(boolean isPasswordProtected)
throws MucConfigurationNotSupportedException {
if (!supportsMembersOnly()) {
if (!supportsPasswordProtected()) {
throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM);
}
answerForm.setAnswer(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM, isPasswordProtected);