Package org.jivesoftware.smackx.muc
Class MucConfigFormManager
java.lang.Object
org.jivesoftware.smackx.muc.MucConfigFormManager
Multi-User Chat configuration form manager is used to fill out and submit a
FilledForm
used to
configure rooms.
Room configuration needs either be done right after the room is created and still locked. Or at
any later point (see XEP-45 § 10.2
Subsequent Room Configuration). When done with the configuration, call
submitConfigurationForm()
.
The manager may not provide all possible configuration options. If you want direct access to the
configuration form, use MultiUserChat.getConfigurationForm()
and
MultiUserChat.sendConfigurationForm(FillableForm)
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
The constant String "muc#roomconfig_changesubject".static final String
The constant String "muc#roomconfig_enablelogging".static final String
The constant String "muc#roomconfig_membersonly".static final String
The constant String "muc#roomconfig_moderatedroom".static final String
The constant String "muc#roomconfig_passwordprotectedroom".static final String
The constant String "muc#roomconfig_publicroom".static final String
The constant String "muc#roomconfig_roomadmins".static final String
The constant String "muc#roomconfig_roomname".static final String
The constant String "muc#roomconfig_roomowners".static final String
The constant String "muc#roomconfig_roomsecret". -
Method Summary
Modifier and TypeMethodDescriptionMake the room hidden (not publicly searchable).Make the room for members only.Make the room moderated.Make the room password protected.Make the room publicly searchable.boolean
setAndEnablePassword
(String password) Set a password and make the room password protected.setChangeSubjectByOccupant
(boolean enabled) setIsPasswordProtected
(boolean isPasswordProtected) Set if this room is password protected.setMembersOnly
(boolean isMembersOnly) Set if the room is members only.setModerated
(boolean isModerated) Set if the room is members only.setPublic
(boolean isPublic) Set if the room is publicly searchable (i.e.setPublicLogging
(boolean enabled) setRoomAdmins
(Collection<? extends Jid> newAdmins) Set the admins of the room.setRoomName
(String roomName) setRoomOwners
(Collection<? extends Jid> newOwners) Set the owners of the room.setRoomSecret
(String secret) Set the room secret, aka the room password.void
Submit the configuration asFilledForm
to the room.boolean
boolean
Check if the room supports a members only configuration.boolean
Check if the room supports being moderated in the configuration.boolean
Check if the room supports password protection.boolean
boolean
Check if the room supports its visibility being controlled via configuration.boolean
Check if the room supports room admins.boolean
boolean
Check if the room supports room owners.
-
Field Details
-
FORM_TYPE
- See Also:
-
MUC_ROOMCONFIG_ROOMOWNERS
The constant String "muc#roomconfig_roomowners". -
MUC_ROOMCONFIG_ROOMADMINS
The constant String "muc#roomconfig_roomadmins". -
MUC_ROOMCONFIG_MEMBERSONLY
The constant String "muc#roomconfig_membersonly".- See Also:
-
MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM
The constant String "muc#roomconfig_passwordprotectedroom". -
MUC_ROOMCONFIG_ROOMSECRET
The constant String "muc#roomconfig_roomsecret".- See Also:
-
MUC_ROOMCONFIG_MODERATEDROOM
The constant String "muc#roomconfig_moderatedroom".- See Also:
-
MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM
The constant String "muc#roomconfig_publicroom".- See Also:
-
MUC_ROOMCONFIG_ROOMNAME
The constant String "muc#roomconfig_roomname".- See Also:
-
MUC_ROOMCONFIG_ENABLE_PUBLIC_LOGGING
The constant String "muc#roomconfig_enablelogging".- See Also:
-
MUC_ROOMCONFIG_CHANGE_SUBJECT
The constant String "muc#roomconfig_changesubject".- See Also:
-
-
Method Details
-
supportsRoomOwners
Check if the room supports room owners.- Returns:
true
if supported,false
if not.- See Also:
-
supportsRoomAdmins
Check if the room supports room admins.- Returns:
true
if supported,false
if not.- See Also:
-
setRoomOwners
public MucConfigFormManager setRoomOwners(Collection<? extends Jid> newOwners) throws MultiUserChatException.MucConfigurationNotSupportedException Set the owners of the room.- Parameters:
newOwners
- a collection of JIDs to become the new owners of the room.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the MUC service does not support this option.- See Also:
-
setRoomAdmins
public MucConfigFormManager setRoomAdmins(Collection<? extends Jid> newAdmins) throws MultiUserChatException.MucConfigurationNotSupportedException Set the admins of the room.- Parameters:
newAdmins
- a collection of JIDs to become the new admins of the room.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the MUC service does not support this option.- See Also:
-
supportsMembersOnly
Check if the room supports a members only configuration.- Returns:
true
if supported,false
if not.
-
supportsModeration
Check if the room supports being moderated in the configuration.- Returns:
true
if supported,false
if not.
-
makeMembersOnly
public MucConfigFormManager makeMembersOnly() throws MultiUserChatException.MucConfigurationNotSupportedExceptionMake the room for members only.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
setMembersOnly
public MucConfigFormManager setMembersOnly(boolean isMembersOnly) throws MultiUserChatException.MucConfigurationNotSupportedException Set if the room is members only. Rooms are not members only per default.- Parameters:
isMembersOnly
- if the room should be members only.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
makeModerated
public MucConfigFormManager makeModerated() throws MultiUserChatException.MucConfigurationNotSupportedExceptionMake the room moderated.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
setModerated
public MucConfigFormManager setModerated(boolean isModerated) throws MultiUserChatException.MucConfigurationNotSupportedException Set if the room is members only. Rooms are not members only per default.- Parameters:
isModerated
- if the room should be moderated.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
supportsPublicRoom
Check if the room supports its visibility being controlled via configuration.- Returns:
true
if supported,false
if not.
-
makePublic
public MucConfigFormManager makePublic() throws MultiUserChatException.MucConfigurationNotSupportedExceptionMake the room publicly searchable.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
makeHidden
public MucConfigFormManager makeHidden() throws MultiUserChatException.MucConfigurationNotSupportedExceptionMake the room hidden (not publicly searchable).- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
setPublic
public MucConfigFormManager setPublic(boolean isPublic) throws MultiUserChatException.MucConfigurationNotSupportedException Set if the room is publicly searchable (i.e. visible via discovery requests to the MUC service).- Parameters:
isPublic
- if the room should be publicly searchable.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
supportsRoomname
-
setRoomName
public MucConfigFormManager setRoomName(String roomName) throws MultiUserChatException.MucConfigurationNotSupportedException -
supportsPasswordProtected
Check if the room supports password protection.- Returns:
true
if supported,false
if not.
-
setAndEnablePassword
public MucConfigFormManager setAndEnablePassword(String password) throws MultiUserChatException.MucConfigurationNotSupportedException Set a password and make the room password protected. Users will need to supply the password to join the room.- Parameters:
password
- the password to set.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
makePasswordProtected
public MucConfigFormManager makePasswordProtected() throws MultiUserChatException.MucConfigurationNotSupportedExceptionMake the room password protected.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
setIsPasswordProtected
public MucConfigFormManager setIsPasswordProtected(boolean isPasswordProtected) throws MultiUserChatException.MucConfigurationNotSupportedException Set if this room is password protected. Rooms are by default not password protected.- Parameters:
isPasswordProtected
- TODO javadoc me please- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
supportsPublicLogging
-
setPublicLogging
public MucConfigFormManager setPublicLogging(boolean enabled) throws MultiUserChatException.MucConfigurationNotSupportedException -
enablePublicLogging
-
disablPublicLogging
-
setRoomSecret
public MucConfigFormManager setRoomSecret(String secret) throws MultiUserChatException.MucConfigurationNotSupportedException 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. UsesetAndEnablePassword(String)
to set a password and make the room protected.- Parameters:
secret
- the secret/password.- Returns:
- a reference to this object.
- Throws:
MultiUserChatException.MucConfigurationNotSupportedException
- if the requested MUC configuration is not supported by the MUC service.
-
supportsChangeSubjectByOccupant
-
occupantsAreAllowedToChangeSubject
public boolean occupantsAreAllowedToChangeSubject() throws MultiUserChatException.MucConfigurationNotSupportedException -
setChangeSubjectByOccupant
public MucConfigFormManager setChangeSubjectByOccupant(boolean enabled) throws MultiUserChatException.MucConfigurationNotSupportedException -
allowOccupantsToChangeSubject
-
disallowOccupantsToChangeSubject
-
submitConfigurationForm
public void submitConfigurationForm() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedExceptionSubmit the configuration asFilledForm
to the room.- Throws:
SmackException.NoResponseException
- if there was no response from the room.XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-