Openfire 3.3.2 Javadoc

org.jivesoftware.openfire.muc
Interface MUCRoom

All Known Implementing Classes:
MUCRoomImpl

public interface MUCRoom

A chat room on the chat server manages its users, and enforces it's own security rules.

Author:
Gaston Dombiak

Method Summary
 List<Presence> addAdmin(String bareJID, MUCRole senderRole)
          Adds a new user to the list of admins.
 List<Presence> addAdmins(List<String> newAdmins, MUCRole senderRole)
          Adds a list of users to the list of admins.
 void addFirstOwner(String bareJID)
          Adds a new user to the list of owners.
 List<Presence> addMember(String bareJID, String nickname, MUCRole senderRole)
          Adds a new user to the list of members.
 Presence addModerator(JID fullJID, MUCRole senderRole)
          Changes the role of the user within the room to moderator.
 List<Presence> addNone(String bareJID, MUCRole senderRole)
          Removes the user from all the other affiliation list thus giving the user a NONE affiliation.
 List<Presence> addOutcast(String bareJID, String reason, MUCRole senderRole)
          Adds a new user to the list of outcast users.
 List<Presence> addOwner(String bareJID, MUCRole senderRole)
          Adds a new user to the list of owners.
 List<Presence> addOwners(List<String> newOwners, MUCRole senderRole)
          Adds a list of users to the list of owners.
 Presence addParticipant(JID fullJID, String reason, MUCRole senderRole)
          Changes the role of the user within the room to participant.
 Presence addVisitor(JID jid, MUCRole senderRole)
          Changes the role of the user within the room to visitor.
 boolean canAnyoneDiscoverJID()
          Returns true if every presence packet will include the JID of every occupant.
 boolean canBroadcastPresence(String roleToBroadcast)
          Returns true if the presences of the requested role will be broadcasted.
 boolean canChangeNickname()
          Returns true if room occupants are allowed to change their nicknames in the room.
 boolean canOccupantsChangeSubject()
          Returns true if participants are allowed to change the room's subject.
 boolean canOccupantsInvite()
          Returns true if occupants can invite other users to the room.
 void changeSubject(Message packet, MUCRole role)
          Changes the room's subject if the occupant has enough permissions.
 Presence createPresence(Presence.Type type)
          Create a new presence in this room for the given role.
 void destroyRoom(String alternateJID, String reason)
          Destroys the room.
 Collection<String> getAdmins()
          Returns a collection with the current list of admins.
 MUCRole.Affiliation getAffiliation(String bareJID)
          Returns the affiliation state of the user in the room.
 long getChatLength()
          Returns the total length of the chat session.
 Date getCreationDate()
          Returns the date when the room was created.
 String getDescription()
          Returns a description set by the room's owners about the room.
 Date getEmptyDate()
          Returns the date when the last occupant left the room.
 long getID()
          Obtain a unique numerical id for this room.
 IQAdminHandler getIQAdminHandler()
           
 IQOwnerHandler getIQOwnerHandler()
           
 int getMaxUsers()
          Returns the maximum number of occupants that can be simultaneously in the room.
 Collection<String> getMembers()
          Returns a collection with the current list of room members.
 Collection<MUCRole> getModerators()
          Returns a collection with the current list of room moderators.
 Date getModificationDate()
          Returns the last date when the room's configuration was modified.
 String getName()
          Get the name of this room.
 String getNaturalLanguageName()
          Returns the natural language name of the room.
 MUCRole getOccupant(String nickname)
          Obtain the role of a given user by nickname.
 MUCRole getOccupantByFullJID(JID jid)
          Obtain the role of a given user in the room by his full JID.
 Collection<MUCRole> getOccupants()
          Obtain the roles of all users in the chatroom.
 List<MUCRole> getOccupantsByBareJID(String jid)
          Obtain the roles of a given user in the room by his bare JID.
 int getOccupantsCount()
          Returns the number of occupants in the chatroom at the moment.
 Collection<String> getOutcasts()
          Returns a collection with the current list of outcast users.
 Collection<String> getOwners()
          Returns a collection with the current list of owners.
 Collection<MUCRole> getParticipants()
          Returns a collection with the current list of room participants.
 String getPassword()
          Returns the password that the user must provide to enter the room.
 String getReservedNickname(String bareJID)
          Returns the reserved room nickname for the bare JID or null if none.
 MUCRole getRole()
          Obtain the role of the chat server (mainly for addressing messages and presence).
 List<String> getRolesToBroadcastPresence()
          Returns the list of roles of which presence will be broadcasted to the rest of the occupants.
 MUCRoomHistory getRoomHistory()
          Returns the history of the room which includes chat transcripts.
 String getSubject()
          Returns the last subject that some occupant set to the room.
 boolean hasOccupant(String nickname)
          Determine if a given nickname is taken.
 boolean isLocked()
          Returns true if the room is locked.
 boolean isLogEnabled()
          Returns true if the room's conversation is being logged.
 boolean isLoginRestrictedToNickname()
          Returns true if registered users can only join the room using their registered nickname.
 boolean isManuallyLocked()
          Returns true if the room is locked and it was locked by a room owner after the room was initially configured.
 boolean isMembersOnly()
          Returns true if the room requires an invitation to enter.
 boolean isModerated()
          Returns if the room in which only those with "voice" may send messages to all occupants.
 boolean isPasswordProtected()
          Returns true if a user cannot enter without first providing the correct password.
 boolean isPersistent()
          Returns true if the room is not destroyed if the last occupant exits.
 boolean isPublicRoom()
          Returns true if the room is searchable and visible through service discovery.
 boolean isRegistrationEnabled()
          Returns true if users are allowed to register with the room.
 MUCRole joinRoom(String nickname, String password, HistoryRequest historyRequest, MUCUser user, Presence presence)
          Joins the room using the given nickname.
 Presence kickOccupant(JID fullJID, JID actorJID, String reason)
          Kicks a user from the room.
 void leaveRoom(String nickname)
          Remove a member from the chat room.
 void lock(MUCRole senderRole)
          Locks the room so that users cannot join the room.
 void nicknameChanged(String oldNick, String newNick)
          An event callback fired whenever an occupant changes his nickname within the chatroom.
 void saveToDB()
          Saves the room configuration to the DB.
 void send(Packet packet)
          Sends a packet to the user.
 void sendInvitation(JID to, String reason, MUCRole role, List<org.dom4j.Element> extensions)
          Sends an invitation to a user.
 void sendInvitationRejection(JID to, String reason, JID from)
          Sends the rejection to the inviter.
 void sendPrivatePacket(Packet packet, MUCRole senderRole)
          Sends a private packet to a selected occupant.
 void sendPublicMessage(Message message, MUCRole senderRole)
          Sends a message to the all the occupants.
 void serverBroadcast(String msg)
          Broadcast a given message to all members of this chat room.
 void setCanAnyoneDiscoverJID(boolean canAnyoneDiscoverJID)
          Sets if every presence packet will include the JID of every occupant.
 void setCanOccupantsChangeSubject(boolean canOccupantsChangeSubject)
          Sets if participants are allowed to change the room's subject.
 void setCanOccupantsInvite(boolean canOccupantsInvite)
          Sets if occupants can invite other users to the room.
 void setChangeNickname(boolean canChange)
          Sets if room occupants are allowed to change their nicknames in the room.
 void setCreationDate(Date creationDate)
          Sets the date when the room was created.
 void setDescription(String description)
          Sets a description set by the room's owners about the room.
 void setEmptyDate(Date emptyDate)
          Sets the date when the last occupant left the room.
 void setID(long roomID)
          Sets a new room ID if the room has just been saved to the database or sets the saved ID of the room in the database while loading the room.
 void setLogEnabled(boolean logEnabled)
          Sets if the room's conversation is being logged.
 void setLoginRestrictedToNickname(boolean restricted)
          Sets if registered users can only join the room using their registered nickname.
 void setMaxUsers(int maxUsers)
          Sets the maximum number of occupants that can be simultaneously in the room.
 List<Presence> setMembersOnly(boolean membersOnly)
          Sets if the room requires an invitation to enter.
 void setModerated(boolean moderated)
          Sets if the room in which only those with "voice" may send messages to all occupants.
 void setModificationDate(Date modificationDate)
          Sets the last date when the room's configuration was modified.
 void setNaturalLanguageName(String naturalLanguageName)
          Sets the natural language name of the room.
 void setPassword(String password)
          Sets the password that the user must provide to enter the room.
 void setPersistent(boolean persistent)
          Sets if the room is not destroyed if the last occupant exits.
 void setPublicRoom(boolean publicRoom)
          Sets if the room is searchable and visible through service discovery.
 void setRegistrationEnabled(boolean registrationEnabled)
          Sets if users are allowed to register with the room.
 void setRolesToBroadcastPresence(List<String> rolesToBroadcastPresence)
          Sets the list of roles of which presence will be broadcasted to the rest of the occupants.
 void setSavedToDB(boolean saved)
          Sets if the room has already been made persistent.
 void setSubject(String subject)
          Sets the last subject that some occupant set to the room.
 void unlock(MUCRole senderRole)
          Unlocks the room so that users can join the room.
 boolean wasSavedToDB()
          Returns true if the room has already been made persistent.
 

Method Detail

getName

String getName()
Get the name of this room.

Returns:
The name for this room

getID

long getID()
Obtain a unique numerical id for this room. Useful for storing rooms in databases. If the room is persistent or is logging the conversation then the returned ID won't be -1.

Returns:
The unique id for this room or -1 if the room is temporary and is not logging the conversation.

setID

void setID(long roomID)
Sets a new room ID if the room has just been saved to the database or sets the saved ID of the room in the database while loading the room.

Parameters:
roomID - the saved ID of the room in the DB or a new one if the room is being saved to the DB.

getCreationDate

Date getCreationDate()
Returns the date when the room was created.

Returns:
the date when the room was created.

setCreationDate

void setCreationDate(Date creationDate)
Sets the date when the room was created.

Parameters:
creationDate - the date when the room was created.

getModificationDate

Date getModificationDate()
Returns the last date when the room's configuration was modified. If the room's configuration was never modified then the creation date will be returned.

Returns:
the last date when the room's configuration was modified.

setModificationDate

void setModificationDate(Date modificationDate)
Sets the last date when the room's configuration was modified. If the room's configuration was never modified then the initial value will be the same as the creation date.

Parameters:
modificationDate - the last date when the room's configuration was modified.

setEmptyDate

void setEmptyDate(Date emptyDate)
Sets the date when the last occupant left the room. A null value means that there are occupants in the room at the moment.

Parameters:
emptyDate - the date when the last occupant left the room or null if there are occupants in the room.

getEmptyDate

Date getEmptyDate()
Returns the date when the last occupant left the room. A null value means that there are occupants in the room at the moment.

Returns:
the date when the last occupant left the room or null if there are occupants in the room at the moment.

getRole

MUCRole getRole()
Obtain the role of the chat server (mainly for addressing messages and presence).

Returns:
The role for the chat room itself

getOccupant

MUCRole getOccupant(String nickname)
                    throws UserNotFoundException
Obtain the role of a given user by nickname.

Parameters:
nickname - The nickname of the user you'd like to obtain
Returns:
The user's role in the room
Throws:
UserNotFoundException - If there is no user with the given nickname

getOccupantsByBareJID

List<MUCRole> getOccupantsByBareJID(String jid)
                                    throws UserNotFoundException
Obtain the roles of a given user in the room by his bare JID. A user can have several roles, one for each client resource from which the user has joined the room.

Parameters:
jid - The bare jid of the user you'd like to obtain
Returns:
The user's roles in the room
Throws:
UserNotFoundException - If there is no user with the given nickname

getOccupantByFullJID

MUCRole getOccupantByFullJID(JID jid)
                             throws UserNotFoundException
Obtain the role of a given user in the room by his full JID.

Parameters:
jid - The full jid of the user you'd like to obtain
Returns:
The user's role in the room
Throws:
UserNotFoundException - If there is no user with the given nickname

getOccupants

Collection<MUCRole> getOccupants()
Obtain the roles of all users in the chatroom.

Returns:
a collection with all users in the chatroom

getOccupantsCount

int getOccupantsCount()
Returns the number of occupants in the chatroom at the moment.

Returns:
int the number of occupants in the chatroom at the moment.

hasOccupant

boolean hasOccupant(String nickname)
Determine if a given nickname is taken.

Parameters:
nickname - The nickname of the user you'd like to obtain
Returns:
True if a nickname is taken

getReservedNickname

String getReservedNickname(String bareJID)
Returns the reserved room nickname for the bare JID or null if none.

Parameters:
bareJID - The bare jid of the user of which you'd like to obtain his reserved nickname.
Returns:
the reserved room nickname for the bare JID or null if none.

getAffiliation

MUCRole.Affiliation getAffiliation(String bareJID)
Returns the affiliation state of the user in the room. Possible affiliations are MUCRole.OWNER, MUCRole.ADMINISTRATOR, MUCRole.MEMBER, MUCRole.OUTCAST and MUCRole.NONE.

Note: Prerequisite - A lock must already be obtained before sending this message.

Parameters:
bareJID - The bare jid of the user of which you'd like to obtain his affiliation.
Returns:
the affiliation state of the user in the room.

joinRoom

MUCRole joinRoom(String nickname,
                 String password,
                 HistoryRequest historyRequest,
                 MUCUser user,
                 Presence presence)
                 throws UnauthorizedException,
                        UserAlreadyExistsException,
                        RoomLockedException,
                        ForbiddenException,
                        RegistrationRequiredException,
                        ConflictException,
                        ServiceUnavailableException,
                        NotAcceptableException
Joins the room using the given nickname.

Parameters:
nickname - The nickname the user wants to use in the chatroom.
password - The password provided by the user to enter the chatroom or null if none.
historyRequest - The amount of history that the user request or null meaning default.
user - The user joining.
presence - The presence sent by the user to join the room.
Returns:
The role created for the user.
Throws:
UnauthorizedException - If the user doesn't have permision to join the room.
UserAlreadyExistsException - If the nickname is already taken.
RoomLockedException - If the user is trying to join a locked room.
ForbiddenException - If the user is an outcast.
RegistrationRequiredException - If the user is not a member of a members-only room.
ConflictException - If another user attempts to join the room with a nickname reserved by the first user.
ServiceUnavailableException - If the user cannot join the room since the max number of users has been reached.
NotAcceptableException - If the registered user is trying to join with a nickname different than the reserved nickname.

leaveRoom

void leaveRoom(String nickname)
               throws UserNotFoundException
Remove a member from the chat room.

Parameters:
nickname - The user to remove
Throws:
UserNotFoundException - If the nickname is not found.

destroyRoom

void destroyRoom(String alternateJID,
                 String reason)
Destroys the room. Each occupant will be removed and will receive a presence stanza of type "unavailable" whose "from" attribute will be the occupant's nickname that the user knows he or she has been removed from the room.

Parameters:
alternateJID - the alternate JID. Commonly used to provide a replacement room.
reason - the reason why the room was destroyed.

createPresence

Presence createPresence(Presence.Type type)
                        throws UnauthorizedException
Create a new presence in this room for the given role.

Returns:
The new presence
Throws:
UnauthorizedException - If the user doesn't have permission to leave the room

serverBroadcast

void serverBroadcast(String msg)
Broadcast a given message to all members of this chat room. The sender is always set to be the chatroom.

Parameters:
msg - The message to broadcast

getChatLength

long getChatLength()
Returns the total length of the chat session.

Returns:
length of chat session in milliseconds.

addFirstOwner

void addFirstOwner(String bareJID)
Adds a new user to the list of owners. The user is the actual creator of the room. Only the MultiUserChatServer should use this method. Regular owners list maintenance MUST be done through addOwner(String,MUCRole).

Parameters:
bareJID - The bare JID of the user to add as owner.

addOwner

List<Presence> addOwner(String bareJID,
                        MUCRole senderRole)
                        throws ForbiddenException
Adds a new user to the list of owners.

Parameters:
bareJID - The bare JID of the user to add as owner.
senderRole - the role of the user that is trying to modify the owners list.
Returns:
the list of updated presences of all the client resources that the client used to join the room.
Throws:
ForbiddenException - If the user is not allowed to modify the owner list.

addOwners

List<Presence> addOwners(List<String> newOwners,
                         MUCRole senderRole)
                         throws ForbiddenException
Adds a list of users to the list of owners.

Parameters:
newOwners - the list of bare JIDs of the users to add to the list of existing owners.
senderRole - the role of the user that is trying to modify the owners list.
Returns:
the list of updated presences of all the clients resources that the clients used to join the room.
Throws:
ForbiddenException - If the user is not allowed to modify the owner list.

addAdmins

List<Presence> addAdmins(List<String> newAdmins,
                         MUCRole senderRole)
                         throws ForbiddenException,
                                ConflictException
Adds a list of users to the list of admins.

Parameters:
newAdmins - the list of bare JIDs of the users to add to the list of existing admins.
senderRole - the role of the user that is trying to modify the admins list.
Returns:
the list of updated presences of all the clients resources that the clients used to join the room.
Throws:
ForbiddenException - If the user is not allowed to modify the admin list.
ConflictException - If the room was going to lose all its owners.

addAdmin

List<Presence> addAdmin(String bareJID,
                        MUCRole senderRole)
                        throws ForbiddenException,
                               ConflictException
Adds a new user to the list of admins.

Parameters:
bareJID - The bare JID of the user to add as admin.
senderRole - The role of the user that is trying to modify the admins list.
Returns:
the list of updated presences of all the client resources that the client used to join the room.
Throws:
ForbiddenException - If the user is not allowed to modify the admin list.
ConflictException - If the room was going to lose all its owners.

addMember

List<Presence> addMember(String bareJID,
                         String nickname,
                         MUCRole senderRole)
                         throws ForbiddenException,
                                ConflictException
Adds a new user to the list of members.

Parameters:
bareJID - The bare JID of the user to add as a member.
nickname - The reserved nickname of the member for the room or null if none.
senderRole - the role of the user that is trying to modify the members list.
Returns:
the list of updated presences of all the client resources that the client used to join the room.
Throws:
ForbiddenException - If the user is not allowed to modify the members list.
ConflictException - If the desired room nickname is already reserved for the room or if the room was going to lose all its owners.

addOutcast

List<Presence> addOutcast(String bareJID,
                          String reason,
                          MUCRole senderRole)
                          throws NotAllowedException,
                                 ForbiddenException,
                                 ConflictException
Adds a new user to the list of outcast users.

Parameters:
bareJID - The bare JID of the user to add as an outcast.
reason - The reason why the user was banned.
senderRole - The role of the user that initiated the ban.
Returns:
the list of updated presences of all the client resources that the client used to join the room.
Throws:
NotAllowedException - Thrown if trying to ban an owner or an administrator.
ForbiddenException - If the user is not allowed to modify the outcast list.
ConflictException - If the room was going to lose all its owners.

addNone

List<Presence> addNone(String bareJID,
                       MUCRole senderRole)
                       throws ForbiddenException,
                              ConflictException
Removes the user from all the other affiliation list thus giving the user a NONE affiliation.

Parameters:
bareJID - The bare JID of the user to keep with a NONE affiliation.
senderRole - The role of the user that set the affiliation to none.
Returns:
the list of updated presences of all the client resources that the client used to join the room or null if none was updated.
Throws:
ForbiddenException - If the user is not allowed to modify the none list.
ConflictException - If the room was going to lose all its owners.

addModerator

Presence addModerator(JID fullJID,
                      MUCRole senderRole)
                      throws ForbiddenException
Changes the role of the user within the room to moderator. A moderator is allowed to kick occupants as well as granting/revoking voice from occupants.

Parameters:
fullJID - The full JID of the occupant to give moderator privileges.
senderRole - The role of the user that is granting moderator privileges to an occupant.
Returns:
the updated presence of the occupant or null if the JID does not belong to an existing occupant.
Throws:
ForbiddenException - If the user is not allowed to grant moderator privileges.

addParticipant

Presence addParticipant(JID fullJID,
                        String reason,
                        MUCRole senderRole)
                        throws NotAllowedException,
                               ForbiddenException
Changes the role of the user within the room to participant. A participant is allowed to send messages to the room (i.e. has voice) and may change the room's subject.

Parameters:
fullJID - The full JID of the occupant to give participant privileges.
reason - The reason why participant privileges were gave to the user or null if none.
senderRole - The role of the user that is granting participant privileges to an occupant.
Returns:
the updated presence of the occupant or null if the JID does not belong to an existing occupant.
Throws:
NotAllowedException - If trying to change the moderator role to an owner or an admin.
ForbiddenException - If the user is not allowed to grant participant privileges.

addVisitor

Presence addVisitor(JID jid,
                    MUCRole senderRole)
                    throws NotAllowedException,
                           ForbiddenException
Changes the role of the user within the room to visitor. A visitor can receive messages but is not allowed to send messages to the room (i.e. does not has voice) and may invite others to the room.

Parameters:
jid - the full JID of the occupant to change to visitor.
senderRole - the role of the user that is changing the role to visitor.
Returns:
the updated presence of the occupant or null if the JID does not belong to an existing occupant.
Throws:
NotAllowedException - if trying to change the moderator role to an owner or an admin.
ForbiddenException - if the user is not a moderator.

isLocked

boolean isLocked()
Returns true if the room is locked. The lock will persist for a defined period of time. If the room owner does not configure the room within the timeout period, the room owner is assumed to have accepted the default configuration.

Returns:
true if the room is locked.

isManuallyLocked

boolean isManuallyLocked()
Returns true if the room is locked and it was locked by a room owner after the room was initially configured.

Returns:
true if the room is locked and it was locked by a room owner after the room was initially configured.

nicknameChanged

void nicknameChanged(String oldNick,
                     String newNick)
An event callback fired whenever an occupant changes his nickname within the chatroom.

Parameters:
oldNick - old nickname within the room.
newNick - new nickname within the room.

changeSubject

void changeSubject(Message packet,
                   MUCRole role)
                   throws ForbiddenException
Changes the room's subject if the occupant has enough permissions. The occupant must be a moderator or the room must be configured so that anyone can change its subject. Otherwise a forbidden exception will be thrown.

The new subject will be added to the history of the room.

Parameters:
packet - the sent packet to change the room's subject.
role - the role of the user that is trying to change the subject.
Throws:
ForbiddenException - If the user is not allowed to change the subject.

getSubject

String getSubject()
Returns the last subject that some occupant set to the room.

Returns:
the last subject that some occupant set to the room.

setSubject

void setSubject(String subject)
Sets the last subject that some occupant set to the room. This message will only be used when loading a room from the database.

Parameters:
subject - the last known subject of the room.

sendPublicMessage

void sendPublicMessage(Message message,
                       MUCRole senderRole)
                       throws ForbiddenException
Sends a message to the all the occupants. In a moderated room, this privilege is restricted to occupants with a role of participant or higher. In an unmoderated room, any occupant can send a message to all other occupants.

Parameters:
message - The message to send.
senderRole - the role of the user that is trying to send a public message.
Throws:
ForbiddenException - If the user is not allowed to send a public message (i.e. does not have voice in the room).

sendPrivatePacket

void sendPrivatePacket(Packet packet,
                       MUCRole senderRole)
                       throws NotFoundException
Sends a private packet to a selected occupant. The packet can be a Message for private conversation between room occupants or IQ packets when an occupant wants to send IQ packets to other room occupants.

Parameters:
packet - The packet to send.
senderRole - the role of the user that is trying to send a public message.
Throws:
NotFoundException - If the user is sending a packet to a room JID that does not exist.

kickOccupant

Presence kickOccupant(JID fullJID,
                      JID actorJID,
                      String reason)
                      throws NotAllowedException
Kicks a user from the room. If the user was in the room, the returned updated presence will be sent to the remaining occupants.

Parameters:
fullJID - The full JID of the kicked user.
actorJID - The JID of the actor that initiated the kick.
reason - The reason why the user was kicked.
Returns:
the updated presence of the kicked user or null if the user was not in the room.
Throws:
NotAllowedException - Thrown if trying to ban an owner or an administrator.

getIQOwnerHandler

IQOwnerHandler getIQOwnerHandler()

getIQAdminHandler

IQAdminHandler getIQAdminHandler()

getRoomHistory

MUCRoomHistory getRoomHistory()
Returns the history of the room which includes chat transcripts.

Returns:
the history of the room which includes chat transcripts.

getOwners

Collection<String> getOwners()
Returns a collection with the current list of owners. The collection contains the bareJID of the users with owner affiliation.

Returns:
a collection with the current list of owners.

getAdmins

Collection<String> getAdmins()
Returns a collection with the current list of admins. The collection contains the bareJID of the users with admin affiliation.

Returns:
a collection with the current list of admins.

getMembers

Collection<String> getMembers()
Returns a collection with the current list of room members. The collection contains the bareJID of the users with member affiliation. If the room is not members-only then the list will contain the users that registered with the room and therefore they may have reserved a nickname.

Returns:
a collection with the current list of members.

getOutcasts

Collection<String> getOutcasts()
Returns a collection with the current list of outcast users. An outcast user is not allowed to join the room again. The collection contains the bareJID of the users with outcast affiliation.

Returns:
a collection with the current list of outcast users.

getModerators

Collection<MUCRole> getModerators()
Returns a collection with the current list of room moderators. The collection contains the MUCRole of the occupants with moderator role.

Returns:
a collection with the current list of moderators.

getParticipants

Collection<MUCRole> getParticipants()
Returns a collection with the current list of room participants. The collection contains the MUCRole of the occupants with participant role.

Returns:
a collection with the current list of moderators.

canAnyoneDiscoverJID

boolean canAnyoneDiscoverJID()
Returns true if every presence packet will include the JID of every occupant. This configuration can be modified by the owner while editing the room's configuration.

Returns:
true if every presence packet will include the JID of every occupant.

setCanAnyoneDiscoverJID

void setCanAnyoneDiscoverJID(boolean canAnyoneDiscoverJID)
Sets if every presence packet will include the JID of every occupant. This configuration can be modified by the owner while editing the room's configuration.

Parameters:
canAnyoneDiscoverJID - boolean that specifies if every presence packet will include the JID of every occupant.

canOccupantsChangeSubject

boolean canOccupantsChangeSubject()
Returns true if participants are allowed to change the room's subject.

Returns:
true if participants are allowed to change the room's subject.

setCanOccupantsChangeSubject

void setCanOccupantsChangeSubject(boolean canOccupantsChangeSubject)
Sets if participants are allowed to change the room's subject.

Parameters:
canOccupantsChangeSubject - boolean that specifies if participants are allowed to change the room's subject.

canOccupantsInvite

boolean canOccupantsInvite()
Returns true if occupants can invite other users to the room. If the room does not require an invitation to enter (i.e. is not members-only) then any occupant can send invitations. On the other hand, if the room is members-only and occupants cannot send invitation then only the room owners and admins are allowed to send invitations.

Returns:
true if occupants can invite other users to the room.

setCanOccupantsInvite

void setCanOccupantsInvite(boolean canOccupantsInvite)
Sets if occupants can invite other users to the room. If the room does not require an invitation to enter (i.e. is not members-only) then any occupant can send invitations. On the other hand, if the room is members-only and occupants cannot send invitation then only the room owners and admins are allowed to send invitations.

Parameters:
canOccupantsInvite - boolean that specified in any occupant can invite other users to the room.

getNaturalLanguageName

String getNaturalLanguageName()
Returns the natural language name of the room. This name can only be modified by room owners. It's mainly used for users while discovering rooms hosted by the Multi-User Chat service.

Returns:
the natural language name of the room.

setNaturalLanguageName

void setNaturalLanguageName(String naturalLanguageName)
Sets the natural language name of the room. This name can only be modified by room owners. It's mainly used for users while discovering rooms hosted by the Multi-User Chat service.

Parameters:
naturalLanguageName - the natural language name of the room.

getDescription

String getDescription()
Returns a description set by the room's owners about the room. This information will be used when discovering extended information about the room.

Returns:
a description set by the room's owners about the room.

setDescription

void setDescription(String description)
Sets a description set by the room's owners about the room. This information will be used when discovering extended information about the room.

Parameters:
description - a description set by the room's owners about the room.

isMembersOnly

boolean isMembersOnly()
Returns true if the room requires an invitation to enter. That is if the room is members-only.

Returns:
true if the room requires an invitation to enter.

setMembersOnly

List<Presence> setMembersOnly(boolean membersOnly)
Sets if the room requires an invitation to enter. That is if the room is members-only.

Parameters:
membersOnly - if true then the room is members-only.
Returns:
the list of updated presences of all the occupants that aren't members of the room if the room is now members-only.

isLogEnabled

boolean isLogEnabled()
Returns true if the room's conversation is being logged. If logging is activated the room conversation will be saved to the database every couple of minutes. The saving frequency is the same for all the rooms and can be configured by changing the property "xmpp.muc.tasks.log.timeout" of MultiUserChatServerImpl.

Returns:
true if the room's conversation is being logged.

setLogEnabled

void setLogEnabled(boolean logEnabled)
Sets if the room's conversation is being logged. If logging is activated the room conversation will be saved to the database every couple of minutes. The saving frequency is the same for all the rooms and can be configured by changing the property "xmpp.muc.tasks.log.timeout" of MultiUserChatServerImpl.

Parameters:
logEnabled - boolean that specified if the room's conversation must be logged.

isLoginRestrictedToNickname

boolean isLoginRestrictedToNickname()
Returns true if registered users can only join the room using their registered nickname. By default, registered users can join the room using any nickname. A not_acceptable error will be returned if the user tries to join the room with a nickname different than the reserved nickname.

Returns:
true if registered users can only join the room using their registered nickname.

setLoginRestrictedToNickname

void setLoginRestrictedToNickname(boolean restricted)
Sets if registered users can only join the room using their registered nickname. A not_acceptable error will be returned if the user tries to join the room with a nickname different than the reserved nickname.

Parameters:
restricted - if registered users can only join the room using their registered nickname.

canChangeNickname

boolean canChangeNickname()
Returns true if room occupants are allowed to change their nicknames in the room. By default, occupants are allowed to change their nicknames. A not_acceptable error will be returned if an occupant tries to change his nickname and this feature is not enabled.

Notice that this feature is not supported by the MUC spec so answering a not_acceptable error may break some cliens.

Returns:
true if room occupants are allowed to change their nicknames in the room.

setChangeNickname

void setChangeNickname(boolean canChange)
Sets if room occupants are allowed to change their nicknames in the room. By default, occupants are allowed to change their nicknames. A not_acceptable error will be returned if an occupant tries to change his nickname and this feature is not enabled.

Notice that this feature is not supported by the MUC spec so answering a not_acceptable error may break some cliens.

Parameters:
canChange - if room occupants are allowed to change their nicknames in the room.

isRegistrationEnabled

boolean isRegistrationEnabled()
Returns true if users are allowed to register with the room. By default, room registration is enabled. A not_allowed error will be returned if a user tries to register with the room and this feature is disabled.

Returns:
true if users are allowed to register with the room.

setRegistrationEnabled

void setRegistrationEnabled(boolean registrationEnabled)
Sets if users are allowed to register with the room. By default, room registration is enabled. A not_allowed error will be returned if a user tries to register with the room and this feature is disabled.

Parameters:
registrationEnabled - if users are allowed to register with the room.

getMaxUsers

int getMaxUsers()
Returns the maximum number of occupants that can be simultaneously in the room. If the number is zero then there is no limit.

Returns:
the maximum number of occupants that can be simultaneously in the room. Zero means unlimited number of occupants.

setMaxUsers

void setMaxUsers(int maxUsers)
Sets the maximum number of occupants that can be simultaneously in the room. If the number is zero then there is no limit.

Parameters:
maxUsers - the maximum number of occupants that can be simultaneously in the room. Zero means unlimited number of occupants.

isModerated

boolean isModerated()
Returns if the room in which only those with "voice" may send messages to all occupants.

Returns:
if the room in which only those with "voice" may send messages to all occupants.

setModerated

void setModerated(boolean moderated)
Sets if the room in which only those with "voice" may send messages to all occupants.

Parameters:
moderated - if the room in which only those with "voice" may send messages to all occupants.

isPasswordProtected

boolean isPasswordProtected()
Returns true if a user cannot enter without first providing the correct password.

Returns:
true if a user cannot enter without first providing the correct password.

getPassword

String getPassword()
Returns the password that the user must provide to enter the room.

Returns:
the password that the user must provide to enter the room.

setPassword

void setPassword(String password)
Sets the password that the user must provide to enter the room.

Parameters:
password - the password that the user must provide to enter the room.

isPersistent

boolean isPersistent()
Returns true if the room is not destroyed if the last occupant exits. Persistent rooms are saved to the database to make their configurations persistent together with the affiliation of the users.

Returns:
true if the room is not destroyed if the last occupant exits.

setPersistent

void setPersistent(boolean persistent)
Sets if the room is not destroyed if the last occupant exits. Persistent rooms are saved to the database to make their configurations persistent together with the affiliation of the users.

Parameters:
persistent - if the room is not destroyed if the last occupant exits.

wasSavedToDB

boolean wasSavedToDB()
Returns true if the room has already been made persistent. If the room is temporary the answer will always be false.

Returns:
true if the room has already been made persistent.

setSavedToDB

void setSavedToDB(boolean saved)
Sets if the room has already been made persistent.

Parameters:
saved - boolean that indicates if the room was saved to the database.

saveToDB

void saveToDB()
Saves the room configuration to the DB. After the room has been saved to the DB it will become persistent.


isPublicRoom

boolean isPublicRoom()
Returns true if the room is searchable and visible through service discovery.

Returns:
true if the room is searchable and visible through service discovery.

setPublicRoom

void setPublicRoom(boolean publicRoom)
Sets if the room is searchable and visible through service discovery.

Parameters:
publicRoom - if the room is searchable and visible through service discovery.

getRolesToBroadcastPresence

List<String> getRolesToBroadcastPresence()
Returns the list of roles of which presence will be broadcasted to the rest of the occupants. This feature is useful for implementing "invisible" occupants.

Returns:
the list of roles of which presence will be broadcasted to the rest of the occupants.

setRolesToBroadcastPresence

void setRolesToBroadcastPresence(List<String> rolesToBroadcastPresence)
Sets the list of roles of which presence will be broadcasted to the rest of the occupants. This feature is useful for implementing "invisible" occupants.

Parameters:
rolesToBroadcastPresence - the list of roles of which presence will be broadcasted to the rest of the occupants.

canBroadcastPresence

boolean canBroadcastPresence(String roleToBroadcast)
Returns true if the presences of the requested role will be broadcasted.

Parameters:
roleToBroadcast - the role to check if its presences will be broadcasted.
Returns:
true if the presences of the requested role will be broadcasted.

lock

void lock(MUCRole senderRole)
          throws ForbiddenException
Locks the room so that users cannot join the room. Only the owner of the room can lock/unlock the room.

Parameters:
senderRole - the role of the occupant that locked the room.
Throws:
ForbiddenException - If the user is not an owner of the room.

unlock

void unlock(MUCRole senderRole)
            throws ForbiddenException
Unlocks the room so that users can join the room. The room is locked when created and only the owner of the room can unlock it by sending the configuration form to the Multi-User Chat service.

Parameters:
senderRole - the role of the occupant that unlocked the room.
Throws:
ForbiddenException - If the user is not an owner of the room.

sendInvitation

void sendInvitation(JID to,
                    String reason,
                    MUCRole role,
                    List<org.dom4j.Element> extensions)
                    throws ForbiddenException
Sends an invitation to a user. The invitation will be sent as if the room is inviting the user. The invitation will include the original occupant the sent the invitation together with the reason for the invitation if any. Since the invitee could be offline at the moment we need the originating session so that the offline strategy could potentially bounce the message with the invitation.

Parameters:
to - the JID of the user that is being invited.
reason - the reason of the invitation or null if none.
role - the role of the occupant that sent the invitation.
extensions - the list of extensions sent with the original message invitation or null if none.
Throws:
ForbiddenException - If the user is not allowed to send the invitation.

sendInvitationRejection

void sendInvitationRejection(JID to,
                             String reason,
                             JID from)
Sends the rejection to the inviter. The rejection will be sent as if the room is rejecting the invitation is named of the invitee. The rejection will include the address of the invitee together with the reason for the rejection if any. Since the inviter could be offline at the moment we need the originating session so that the offline strategy could potentially bounce the message with the rejection.

Parameters:
to - the JID of the user that is originated the invitation.
reason - the reason for the rejection or null if none.
from - the JID of the invitee that is rejecting the invitation.

send

void send(Packet packet)
Sends a packet to the user.

Parameters:
packet - The packet to send

Openfire 3.3.2 Javadoc

Copyright © 2003-2007 Jive Software.