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_PASSWORDPROTECTEDROOM
The constant String "muc#roomconfig_passwordprotectedroom".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
makeMembersOnly()
Make the room for members only.MucConfigFormManager
makePasswordProtected()
Make the room password protected.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
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
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
-
-
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.
-
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.
-
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.
-
-