Package org.jivesoftware.smackx.muc
Class MucConfigFormManager
- java.lang.Object
-
- org.jivesoftware.smackx.muc.MucConfigFormManager
-
public class MucConfigFormManager extends Object
Multi-User Chat configuration form manager is used to fill out and submit aFilledForm
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()
andMultiUserChat.sendConfigurationForm(FillableForm)
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FORM_TYPE
static String
MUC_ROOMCONFIG_MEMBERSONLY
The constant String "muc#roomconfig_membersonly".static String
MUC_ROOMCONFIG_MODERATEDROOM
The constant String "muc#roomconfig_moderatedroom".static String
MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM
The constant String "muc#roomconfig_passwordprotectedroom".static String
MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM
The constant String "muc#roomconfig_publicroom".static String
MUC_ROOMCONFIG_ROOMOWNERS
The constant String "muc#roomconfig_roomowners".static String
MUC_ROOMCONFIG_ROOMSECRET
The constant String "muc#roomconfig_roomsecret".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MucConfigFormManager
makeHidden()
Make the room hidden (not publicly searchable).MucConfigFormManager
makeMembersOnly()
Make the room for members only.MucConfigFormManager
makeModerated()
Make the room moderated.MucConfigFormManager
makePasswordProtected()
Make the room password protected.MucConfigFormManager
makePublic()
Make the room publicly searchable.MucConfigFormManager
setAndEnablePassword(String password)
Set a password and make the room password protected.MucConfigFormManager
setIsPasswordProtected(boolean isPasswordProtected)
Set if this room is password protected.MucConfigFormManager
setMembersOnly(boolean isMembersOnly)
Set if the room is members only.MucConfigFormManager
setModerated(boolean isModerated)
Set if the room is members only.MucConfigFormManager
setPublic(boolean isPublic)
Set if the room is publicly searchable (i.e.MucConfigFormManager
setRoomOwners(Collection<? extends Jid> newOwners)
Set the owners of the room.MucConfigFormManager
setRoomSecret(String secret)
Set the room secret, aka the room password.void
submitConfigurationForm()
Submit the configuration asFilledForm
to the room.boolean
supportsMembersOnly()
Check if the room supports a members only configuration.boolean
supportsModeration()
Check if the room supports being moderated in the configuration.boolean
supportsPasswordProtected()
Check if the room supports password protection.boolean
supportsRoomOwners()
Check if the room supports room owners.
-
-
-
Field Detail
-
FORM_TYPE
public static final String FORM_TYPE
- See Also:
- Constant Field Values
-
MUC_ROOMCONFIG_ROOMOWNERS
public static final String MUC_ROOMCONFIG_ROOMOWNERS
The constant String "muc#roomconfig_roomowners".
-
MUC_ROOMCONFIG_MEMBERSONLY
public static final String MUC_ROOMCONFIG_MEMBERSONLY
The constant String "muc#roomconfig_membersonly".- See Also:
- Constant Field Values
-
MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM
public static final String MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM
The constant String "muc#roomconfig_passwordprotectedroom".
-
MUC_ROOMCONFIG_ROOMSECRET
public static final String MUC_ROOMCONFIG_ROOMSECRET
The constant String "muc#roomconfig_roomsecret".- See Also:
- Constant Field Values
-
MUC_ROOMCONFIG_MODERATEDROOM
public static final String MUC_ROOMCONFIG_MODERATEDROOM
The constant String "muc#roomconfig_moderatedroom".- See Also:
- Constant Field Values
-
MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM
public static final String MUC_ROOMCONFIG_PUBLICLYSEARCHABLEROOM
The constant String "muc#roomconfig_publicroom".- See Also:
- Constant Field Values
-
-
Method Detail
-
supportsRoomOwners
public boolean supportsRoomOwners()
Check if the room supports room owners.- Returns:
true
if supported,false
if not.- See Also:
MUC_ROOMCONFIG_ROOMOWNERS
-
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:
MUC_ROOMCONFIG_ROOMOWNERS
-
supportsMembersOnly
public boolean supportsMembersOnly()
Check if the room supports a members only configuration.- Returns:
true
if supported,false
if not.
-
supportsModeration
public boolean supportsModeration()
Check if the room supports being moderated in the configuration.- Returns:
true
if supported,false
if not.
-
makeMembersOnly
public MucConfigFormManager makeMembersOnly() throws MultiUserChatException.MucConfigurationNotSupportedException
Make 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.MucConfigurationNotSupportedException
Make 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.
-
makePublic
public MucConfigFormManager makePublic() throws MultiUserChatException.MucConfigurationNotSupportedException
Make 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.MucConfigurationNotSupportedException
Make 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.
-
supportsPasswordProtected
public boolean 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.MucConfigurationNotSupportedException
Make 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.
-
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.
-
submitConfigurationForm
public void submitConfigurationForm() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
Submit 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.
-
-