Class LocalMUCRoom
- java.lang.Object
-
- org.jivesoftware.openfire.muc.spi.LocalMUCRoom
-
- All Implemented Interfaces:
Externalizable
,Serializable
,GroupEventListener
,MUCRoom
,org.xmpp.resultsetmanagement.Result
public class LocalMUCRoom extends Object implements MUCRoom, GroupEventListener
Implementation of a chatroom that is being hosted by this JVM. A LocalMUCRoom could represent a persistent room which means that its configuration will be maintained in synch with its representation in the database.When running in a cluster each cluster node will have its own copy of local rooms. Persistent rooms will be loaded by each cluster node when starting up. Not persistent rooms will be copied from the senior cluster member. All room occupants will be copied from the senior cluster member too.
- Author:
- Gaston Dombiak
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalMUCRoom()
Do not use this constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<org.xmpp.packet.Presence>
addAdmin(org.xmpp.packet.JID jid, MUCRole sendRole)
Adds a new user to the list of admins.List<org.xmpp.packet.Presence>
addAdmins(List<org.xmpp.packet.JID> newAdmins, MUCRole senderRole)
Adds a list of users to the list of admins.void
addFirstOwner(org.xmpp.packet.JID bareJID)
Adds a new user to the list of owners.List<org.xmpp.packet.Presence>
addMember(org.xmpp.packet.JID jid, String nickname, MUCRole sendRole)
Adds a new user to the list of members.org.xmpp.packet.Presence
addModerator(org.xmpp.packet.JID jid, MUCRole senderRole)
Changes the role of the user within the room to moderator.List<org.xmpp.packet.Presence>
addNone(org.xmpp.packet.JID jid, MUCRole senderRole)
Removes the user from all the other affiliation list thus giving the user a NONE affiliation.List<org.xmpp.packet.Presence>
addOutcast(org.xmpp.packet.JID jid, String reason, MUCRole senderRole)
Adds a new user to the list of outcast users.List<org.xmpp.packet.Presence>
addOwner(org.xmpp.packet.JID jid, MUCRole sendRole)
Adds a new user to the list of owners.List<org.xmpp.packet.Presence>
addOwners(List<org.xmpp.packet.JID> newOwners, MUCRole senderRole)
Adds a list of users to the list of owners.org.xmpp.packet.Presence
addParticipant(org.xmpp.packet.JID jid, String reason, MUCRole senderRole)
Changes the role of the user within the room to participant.org.xmpp.packet.Presence
addVisitor(org.xmpp.packet.JID jid, MUCRole senderRole)
Changes the role of the user within the room to visitor.void
adminAdded(Group group, Map params)
An administrator was added to a group.void
adminRemoved(Group group, Map params)
An administrator was removed from a group.void
affiliationAdded(AddAffiliation affiliation)
void
broadcast(BroadcastMessageRequest messageRequest)
void
broadcast(BroadcastPresenceRequest presenceRequest)
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.String
canSendPrivateMessage()
Returns the minimal role of persons that are allowed to send private messages in the room.void
changeSubject(org.xmpp.packet.Message packet, MUCRole role)
Changes the room's subject if the occupant has enough permissions.org.xmpp.packet.Presence
createPresence(org.xmpp.packet.Presence.Type presenceType)
Create a new presence in this room for the given role.void
destroyRoom(DestroyRoomRequest destroyRequest)
void
destroyRoom(org.xmpp.packet.JID alternateJID, String reason)
Destroys the room.boolean
equals(Object obj)
Collection<org.xmpp.packet.JID>
getAdmins()
Returns a collection with the current list of admins.MUCRole.Affiliation
getAffiliation(org.xmpp.packet.JID jid)
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.FMUCHandler
getFmucHandler()
long
getID()
Obtain a unique numerical id for this room.IQAdminHandler
getIQAdminHandler()
IQOwnerHandler
getIQOwnerHandler()
org.xmpp.packet.JID
getJID()
Get the full JID of this room.int
getMaxUsers()
Returns the maximum number of occupants that can be simultaneously in the room.Collection<org.xmpp.packet.JID>
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.MultiUserChatService
getMUCService()
Get the multi user chat service the room is attached to.String
getName()
Get the name of this room.String
getNaturalLanguageName()
Returns the natural language name of the room.MUCRole
getOccupant(String nickname)
Deprecated.PrefergetOccupantsByNickname(String)
(user can be connected more than once)MUCRole
getOccupantByFullJID(org.xmpp.packet.JID jid)
Returns the role of a given user in the room by his full JID ornull
if no role was found for the specified user.Collection<MUCRole>
getOccupants()
Obtain the roles of all users in the chatroom.List<MUCRole>
getOccupantsByBareJID(org.xmpp.packet.JID jid)
Obtain the roles of a given user in the room by his bare JID.List<MUCRole>
getOccupantsByNickname(String nickname)
Obtain the roles of a given user by nickname.int
getOccupantsCount()
Returns the number of occupants in the chatroom at the moment.Collection<org.xmpp.packet.JID>
getOutcasts()
Returns a collection with the current list of outcast users.Collection<org.xmpp.packet.JID>
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(org.xmpp.packet.JID jid)
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).MUCRole.Role
getRole(org.xmpp.packet.JID jid)
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.String
getUID()
void
groupCreated(Group group, Map params)
A group was created.void
groupDeleting(Group group, Map params)
A group is being deleted.void
groupModified(Group group, Map params)
A group's name, description, or an extended property was changed.int
hashCode()
boolean
hasOccupant(String nickname)
Determine if a given nickname is taken.boolean
isFmucEnabled()
Returns true if this room accepts FMUC joins.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, LocalMUCUser user, org.xmpp.packet.Presence presence)
Joins the room using the given nickname.org.xmpp.packet.Presence
kickOccupant(org.xmpp.packet.JID jid, org.xmpp.packet.JID actorJID, String actorNickname, String reason)
Kicks a user from the room.void
leaveRoom(OccupantLeftEvent event)
void
leaveRoom(MUCRole leaveRole)
Remove a member from the chat room.void
lock(MUCRole senderRole)
Locks the room so that users cannot join the room.void
memberAdded(Group group, Map params)
A member was added to a group.void
memberAdded(AddMember addMember)
void
memberRemoved(Group group, Map params)
A member was removed from a group.void
nicknameChanged(ChangeNickname changeNickname)
void
nicknameChanged(MUCRole occupantRole, org.xmpp.packet.Presence newPresence, String oldNick, String newNick)
An event callback fired whenever an occupant changes his nickname within the chatroom.void
occupantAdded(OccupantAddedEvent event)
void
occupantUpdated(UpdateOccupant update)
void
presenceUpdated(UpdatePresence updatePresence)
Updates the presence of an occupant with the new presence included in the request.void
presenceUpdated(MUCRole occupantRole, org.xmpp.packet.Presence newPresence)
Handles occupants updating their presence in the chatroom.void
readExternal(ObjectInput in)
void
saveToDB()
Saves the room configuration to the DB.void
send(org.xmpp.packet.Packet packet, MUCRole sender)
Sends a packet to the user.void
sendInvitation(org.xmpp.packet.JID to, String reason, MUCRole senderRole, List<org.dom4j.Element> extensions)
Sends an invitation to a user.void
sendInvitationRejection(org.xmpp.packet.JID to, String reason, org.xmpp.packet.JID sender)
Sends the rejection to the inviter.void
sendPrivatePacket(org.xmpp.packet.Packet packet, MUCRole senderRole)
Sends a private packet to a selected occupant.void
sendPublicMessage(org.xmpp.packet.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
setCanSendPrivateMessage(String role)
Sets the minimal role of persons that are allowed to send private messages in 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
setFmucEnabled(boolean fmucEnabled)
Sets if this room accepts FMUC joins.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<org.xmpp.packet.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
setMUCService(MultiUserChatService service)
Sets the multi user chat service the room is attached to.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.void
updateConfiguration(LocalMUCRoom otherRoom)
org.xmpp.packet.Presence
updateOccupant(UpdateOccupantRequest updateRequest)
boolean
wasSavedToDB()
Returns true if the room has already been made persistent.void
writeExternal(ObjectOutput out)
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:MUCRoom
Get the name of this room.
-
getJID
public org.xmpp.packet.JID getJID()
Description copied from interface:MUCRoom
Get the full JID of this room.
-
getMUCService
public MultiUserChatService getMUCService()
Description copied from interface:MUCRoom
Get the multi user chat service the room is attached to.- Specified by:
getMUCService
in interfaceMUCRoom
- Returns:
- the MultiUserChatService instance that the room is attached to.
-
setMUCService
public void setMUCService(MultiUserChatService service)
Description copied from interface:MUCRoom
Sets the multi user chat service the room is attached to.- Specified by:
setMUCService
in interfaceMUCRoom
- Parameters:
service
- The MultiUserChatService that the room is attached to (cannot benull
).
-
getID
public long getID()
Description copied from interface:MUCRoom
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.
-
setID
public void setID(long roomID)
Description copied from interface:MUCRoom
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.
-
getCreationDate
public Date getCreationDate()
Description copied from interface:MUCRoom
Returns the date when the room was created.- Specified by:
getCreationDate
in interfaceMUCRoom
- Returns:
- the date when the room was created.
-
setCreationDate
public void setCreationDate(Date creationDate)
Description copied from interface:MUCRoom
Sets the date when the room was created.- Specified by:
setCreationDate
in interfaceMUCRoom
- Parameters:
creationDate
- the date when the room was created (cannot benull
).
-
getModificationDate
public Date getModificationDate()
Description copied from interface:MUCRoom
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.- Specified by:
getModificationDate
in interfaceMUCRoom
- Returns:
- the last date when the room's configuration was modified.
-
setModificationDate
public void setModificationDate(Date modificationDate)
Description copied from interface:MUCRoom
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.- Specified by:
setModificationDate
in interfaceMUCRoom
- Parameters:
modificationDate
- the last date when the room's configuration was modified (cannot benull
).
-
setEmptyDate
public void setEmptyDate(Date emptyDate)
Description copied from interface:MUCRoom
Sets the date when the last occupant left the room. A null value means that there are occupants in the room at the moment.- Specified by:
setEmptyDate
in interfaceMUCRoom
- Parameters:
emptyDate
- the date when the last occupant left the room or null if there are occupants in the room (can benull
).
-
getEmptyDate
public Date getEmptyDate()
Description copied from interface:MUCRoom
Returns the date when the last occupant left the room. A null value means that there are occupants in the room at the moment.- Specified by:
getEmptyDate
in interfaceMUCRoom
- Returns:
- the date when the last occupant left the room or null if there are occupants in the room at the moment.
-
getRole
public MUCRole getRole()
Description copied from interface:MUCRoom
Obtain the role of the chat server (mainly for addressing messages and presence).
-
getOccupant
public MUCRole getOccupant(String nickname) throws UserNotFoundException
Deprecated.PrefergetOccupantsByNickname(String)
(user can be connected more than once)Description copied from interface:MUCRoom
Obtain the first role of a given user by nickname.- Specified by:
getOccupant
in interfaceMUCRoom
- Parameters:
nickname
- The nickname of the user you'd like to obtain (cannot benull
)- Returns:
- The user's role in the room
- Throws:
UserNotFoundException
- If there is no user with the given nickname
-
getOccupantsByNickname
public List<MUCRole> getOccupantsByNickname(String nickname) throws UserNotFoundException
Description copied from interface:MUCRoom
Obtain the roles of a given user by nickname. A user can be connected to a room more than once.- Specified by:
getOccupantsByNickname
in interfaceMUCRoom
- Parameters:
nickname
- The nickname of the user you'd like to obtain (cannot benull
)- Returns:
- The user's role in the room
- Throws:
UserNotFoundException
- If there is no user with the given nickname
-
getOccupantsByBareJID
public List<MUCRole> getOccupantsByBareJID(org.xmpp.packet.JID jid) throws UserNotFoundException
Description copied from interface:MUCRoom
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.- Specified by:
getOccupantsByBareJID
in interfaceMUCRoom
- Parameters:
jid
- The bare jid of the user you'd like to obtain (cannot benull
).- Returns:
- The user's roles in the room
- Throws:
UserNotFoundException
- If there is no user with the given nickname
-
getOccupantByFullJID
public MUCRole getOccupantByFullJID(org.xmpp.packet.JID jid)
Description copied from interface:MUCRoom
Returns the role of a given user in the room by his full JID ornull
if no role was found for the specified user.- Specified by:
getOccupantByFullJID
in interfaceMUCRoom
- Parameters:
jid
- The full jid of the user you'd like to obtain (cannot benull
).- Returns:
- The user's role in the room or null if not found.
-
getOccupants
public Collection<MUCRole> getOccupants()
Description copied from interface:MUCRoom
Obtain the roles of all users in the chatroom.- Specified by:
getOccupants
in interfaceMUCRoom
- Returns:
- a collection with all users in the chatroom
-
getOccupantsCount
public int getOccupantsCount()
Description copied from interface:MUCRoom
Returns the number of occupants in the chatroom at the moment.- Specified by:
getOccupantsCount
in interfaceMUCRoom
- Returns:
- int the number of occupants in the chatroom at the moment.
-
hasOccupant
public boolean hasOccupant(String nickname)
Description copied from interface:MUCRoom
Determine if a given nickname is taken.- Specified by:
hasOccupant
in interfaceMUCRoom
- Parameters:
nickname
- The nickname of the user you'd like to obtain (cannot benull
).- Returns:
- True if a nickname is taken
-
getReservedNickname
public String getReservedNickname(org.xmpp.packet.JID jid)
Description copied from interface:MUCRoom
Returns the reserved room nickname for the bare JID or null if none.- Specified by:
getReservedNickname
in interfaceMUCRoom
- Parameters:
jid
- The bare jid of the user of which you'd like to obtain his reserved nickname (cannot benull
).- Returns:
- the reserved room nickname for the bare JID or null if none.
-
getAffiliation
public MUCRole.Affiliation getAffiliation(@Nonnull org.xmpp.packet.JID jid)
Description copied from interface:MUCRoom
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.
- Specified by:
getAffiliation
in interfaceMUCRoom
- Parameters:
jid
- The bare jid of the user of which you'd like to obtain his affiliation (cannot benull
).- Returns:
- the affiliation state of the user in the room.
-
getRole
public MUCRole.Role getRole(@Nonnull org.xmpp.packet.JID jid)
-
joinRoom
public MUCRole joinRoom(@Nonnull String nickname, @Nullable String password, @Nullable HistoryRequest historyRequest, @Nonnull LocalMUCUser user, @Nonnull org.xmpp.packet.Presence presence) throws UnauthorizedException, UserAlreadyExistsException, RoomLockedException, ForbiddenException, RegistrationRequiredException, ConflictException, ServiceUnavailableException, NotAcceptableException
Description copied from interface:MUCRoom
Joins the room using the given nickname.- Specified by:
joinRoom
in interfaceMUCRoom
- Parameters:
nickname
- The nickname the user wants to use in the chatroom (cannot benull
).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 (cannot benull
).presence
- The presence sent by the user to join the room (cannot benull
).- Returns:
- The role created for the user.
- Throws:
UnauthorizedException
- If the user doesn't have permission 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.
-
occupantAdded
public void occupantAdded(OccupantAddedEvent event)
-
leaveRoom
public void leaveRoom(MUCRole leaveRole)
Description copied from interface:MUCRoom
Remove a member from the chat room.
-
leaveRoom
public void leaveRoom(OccupantLeftEvent event)
-
destroyRoom
public void destroyRoom(DestroyRoomRequest destroyRequest)
-
destroyRoom
public void destroyRoom(org.xmpp.packet.JID alternateJID, String reason)
Description copied from interface:MUCRoom
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.- Specified by:
destroyRoom
in interfaceMUCRoom
- Parameters:
alternateJID
- an optional alternate JID. Commonly used to provide a replacement room. (can benull
)reason
- an optional reason why the room was destroyed (can benull
).
-
createPresence
public org.xmpp.packet.Presence createPresence(org.xmpp.packet.Presence.Type presenceType)
Description copied from interface:MUCRoom
Create a new presence in this room for the given role.- Specified by:
createPresence
in interfaceMUCRoom
- Parameters:
presenceType
- Type of presence to create (cannot benull
).- Returns:
- The new presence
-
serverBroadcast
public void serverBroadcast(String msg)
Description copied from interface:MUCRoom
Broadcast a given message to all members of this chat room. The sender is always set to be the chatroom.- Specified by:
serverBroadcast
in interfaceMUCRoom
- Parameters:
msg
- The message to broadcast (cannot benull
)
-
sendPublicMessage
public void sendPublicMessage(org.xmpp.packet.Message message, MUCRole senderRole) throws ForbiddenException
Description copied from interface:MUCRoom
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.- Specified by:
sendPublicMessage
in interfaceMUCRoom
- Parameters:
message
- The message to send (cannot benull
).senderRole
- the role of the user that is trying to send a public message (cannot benull
).- Throws:
ForbiddenException
- If the user is not allowed to send a public message (i.e. does not have voice in the room).
-
sendPrivatePacket
public void sendPrivatePacket(org.xmpp.packet.Packet packet, MUCRole senderRole) throws NotFoundException, ForbiddenException
Description copied from interface:MUCRoom
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.- Specified by:
sendPrivatePacket
in interfaceMUCRoom
- 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.ForbiddenException
- If a user of this role is not permitted to send private messages in this room.
-
send
public void send(@Nonnull org.xmpp.packet.Packet packet, @Nonnull MUCRole sender)
Description copied from interface:MUCRoom
Sends a packet to the user.
-
broadcast
public void broadcast(BroadcastPresenceRequest presenceRequest)
-
broadcast
public void broadcast(BroadcastMessageRequest messageRequest)
-
getChatLength
public long getChatLength()
Description copied from interface:MUCRoom
Returns the total length of the chat session.- Specified by:
getChatLength
in interfaceMUCRoom
- Returns:
- length of chat session in milliseconds.
-
addFirstOwner
public void addFirstOwner(org.xmpp.packet.JID bareJID)
Description copied from interface:MUCRoom
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 throughMUCRoom.addOwner(JID jid,MUCRole)
.- Specified by:
addFirstOwner
in interfaceMUCRoom
- Parameters:
bareJID
- The bare JID of the user to add as owner (cannot benull
).
-
addOwner
public List<org.xmpp.packet.Presence> addOwner(org.xmpp.packet.JID jid, MUCRole sendRole) throws ForbiddenException
Description copied from interface:MUCRoom
Adds a new user to the list of owners.- Specified by:
addOwner
in interfaceMUCRoom
- Parameters:
jid
- The JID of the user to add as owner (cannot benull
).sendRole
- the role of the user that is trying to modify the owners list (cannot benull
).- 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.
-
addAdmin
public List<org.xmpp.packet.Presence> addAdmin(org.xmpp.packet.JID jid, MUCRole sendRole) throws ForbiddenException, ConflictException
Description copied from interface:MUCRoom
Adds a new user to the list of admins.- Specified by:
addAdmin
in interfaceMUCRoom
- Parameters:
jid
- The JID of the user to add as admin (cannot benull
).sendRole
- The role of the user that is trying to modify the admins list (cannot benull
).- 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
public List<org.xmpp.packet.Presence> addMember(org.xmpp.packet.JID jid, String nickname, MUCRole sendRole) throws ForbiddenException, ConflictException
Description copied from interface:MUCRoom
Adds a new user to the list of members.- Specified by:
addMember
in interfaceMUCRoom
- Parameters:
jid
- The JID of the user to add as a member (cannot benull
).nickname
- The reserved nickname of the member for the room or null if none.sendRole
- the role of the user that is trying to modify the members list (cannot benull
).- 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
public List<org.xmpp.packet.Presence> addOutcast(org.xmpp.packet.JID jid, String reason, MUCRole senderRole) throws NotAllowedException, ForbiddenException, ConflictException
Description copied from interface:MUCRoom
Adds a new user to the list of outcast users.- Specified by:
addOutcast
in interfaceMUCRoom
- Parameters:
jid
- The JID of the user to add as an outcast (cannot benull
).reason
- an optional reason why the user was banned (can benull
).senderRole
- The role of the user that initiated the ban (cannot benull
).- 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
public List<org.xmpp.packet.Presence> addNone(org.xmpp.packet.JID jid, MUCRole senderRole) throws ForbiddenException, ConflictException
Description copied from interface:MUCRoom
Removes the user from all the other affiliation list thus giving the user a NONE affiliation.- Specified by:
addNone
in interfaceMUCRoom
- Parameters:
jid
- The JID of the user to keep with a NONE affiliation (cannot benull
).senderRole
- The role of the user that set the affiliation to none (cannot benull
).- 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.
-
isLocked
public boolean isLocked()
Description copied from interface:MUCRoom
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.
-
isManuallyLocked
public boolean isManuallyLocked()
Description copied from interface:MUCRoom
Returns true if the room is locked and it was locked by a room owner after the room was initially configured.- Specified by:
isManuallyLocked
in interfaceMUCRoom
- Returns:
- true if the room is locked and it was locked by a room owner after the room was initially configured.
-
presenceUpdated
public void presenceUpdated(MUCRole occupantRole, org.xmpp.packet.Presence newPresence)
Handles occupants updating their presence in the chatroom. Assumes the user updates their presence whenever their availability in the room changes. This method should not be called to handle other presence related updates, such as nickname changes. An event callback fired whenever an occupant updated his presence in the chatroom.- Specified by:
presenceUpdated
in interfaceMUCRoom
- Parameters:
occupantRole
- occupant that changed his presence in the room (cannot benull
).newPresence
- presence sent by the occupant (cannot benull
).
-
presenceUpdated
public void presenceUpdated(UpdatePresence updatePresence)
Updates the presence of an occupant with the new presence included in the request.- Parameters:
updatePresence
- request to update an occupant's presence.
-
occupantUpdated
public void occupantUpdated(UpdateOccupant update)
-
updateOccupant
public org.xmpp.packet.Presence updateOccupant(UpdateOccupantRequest updateRequest) throws NotAllowedException
- Throws:
NotAllowedException
-
memberAdded
public void memberAdded(AddMember addMember)
-
affiliationAdded
public void affiliationAdded(AddAffiliation affiliation)
-
nicknameChanged
public void nicknameChanged(MUCRole occupantRole, org.xmpp.packet.Presence newPresence, String oldNick, String newNick)
Description copied from interface:MUCRoom
An event callback fired whenever an occupant changes his nickname within the chatroom.- Specified by:
nicknameChanged
in interfaceMUCRoom
- Parameters:
occupantRole
- occupant that changed his nickname in the room (cannot benull
).newPresence
- presence sent by the occupant with the new nickname (cannot benull
).oldNick
- old nickname within the room (cannot benull
).newNick
- new nickname within the room (cannot benull
).
-
nicknameChanged
public void nicknameChanged(ChangeNickname changeNickname)
-
changeSubject
public void changeSubject(org.xmpp.packet.Message packet, MUCRole role) throws ForbiddenException
Description copied from interface:MUCRoom
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.
- Specified by:
changeSubject
in interfaceMUCRoom
- Parameters:
packet
- the sent packet to change the room's subject (cannot benull
).role
- the role of the user that is trying to change the subject (cannot benull
).- Throws:
ForbiddenException
- If the user is not allowed to change the subject.
-
getSubject
public String getSubject()
Description copied from interface:MUCRoom
Returns the last subject that some occupant set to the room.- Specified by:
getSubject
in interfaceMUCRoom
- Returns:
- the last subject that some occupant set to the room.
-
setSubject
public void setSubject(String subject)
Description copied from interface:MUCRoom
Sets the last subject that some occupant set to the room. This message will only be used when loading a room from the database.- Specified by:
setSubject
in interfaceMUCRoom
- Parameters:
subject
- the last known subject of the room (cannot benull
).
-
sendInvitation
public void sendInvitation(org.xmpp.packet.JID to, String reason, MUCRole senderRole, List<org.dom4j.Element> extensions) throws ForbiddenException, CannotBeInvitedException
Description copied from interface:MUCRoom
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.- Specified by:
sendInvitation
in interfaceMUCRoom
- Parameters:
to
- the JID of the user that is being invited.reason
- the reason of the invitation or null if none.senderRole
- 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.CannotBeInvitedException
- (Optionally) If the user being invited does not have access to the room
-
sendInvitationRejection
public void sendInvitationRejection(org.xmpp.packet.JID to, String reason, org.xmpp.packet.JID sender)
Description copied from interface:MUCRoom
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.- Specified by:
sendInvitationRejection
in interfaceMUCRoom
- Parameters:
to
- the JID of the user that is originated the invitation.reason
- the reason for the rejection or null if none.sender
- the JID of the invitee that is rejecting the invitation.
-
getIQOwnerHandler
public IQOwnerHandler getIQOwnerHandler()
- Specified by:
getIQOwnerHandler
in interfaceMUCRoom
-
getIQAdminHandler
public IQAdminHandler getIQAdminHandler()
- Specified by:
getIQAdminHandler
in interfaceMUCRoom
-
getFmucHandler
public FMUCHandler getFmucHandler()
- Specified by:
getFmucHandler
in interfaceMUCRoom
-
getRoomHistory
public MUCRoomHistory getRoomHistory()
Description copied from interface:MUCRoom
Returns the history of the room which includes chat transcripts.- Specified by:
getRoomHistory
in interfaceMUCRoom
- Returns:
- the history of the room which includes chat transcripts.
-
getOwners
public Collection<org.xmpp.packet.JID> getOwners()
Description copied from interface:MUCRoom
Returns a collection with the current list of owners. The collection contains the bareJID of the users with owner affiliation.
-
getAdmins
public Collection<org.xmpp.packet.JID> getAdmins()
Description copied from interface:MUCRoom
Returns a collection with the current list of admins. The collection contains the bareJID of the users with admin affiliation.
-
getMembers
public Collection<org.xmpp.packet.JID> getMembers()
Description copied from interface:MUCRoom
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.- Specified by:
getMembers
in interfaceMUCRoom
- Returns:
- a collection with the current list of members.
-
getOutcasts
public Collection<org.xmpp.packet.JID> getOutcasts()
Description copied from interface:MUCRoom
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.- Specified by:
getOutcasts
in interfaceMUCRoom
- Returns:
- a collection with the current list of outcast users.
-
getModerators
public Collection<MUCRole> getModerators()
Description copied from interface:MUCRoom
Returns a collection with the current list of room moderators. The collection contains the MUCRole of the occupants with moderator role.- Specified by:
getModerators
in interfaceMUCRoom
- Returns:
- a collection with the current list of moderators.
-
getParticipants
public Collection<MUCRole> getParticipants()
Description copied from interface:MUCRoom
Returns a collection with the current list of room participants. The collection contains the MUCRole of the occupants with participant role.- Specified by:
getParticipants
in interfaceMUCRoom
- Returns:
- a collection with the current list of moderators.
-
addModerator
public org.xmpp.packet.Presence addModerator(org.xmpp.packet.JID jid, MUCRole senderRole) throws ForbiddenException
Description copied from interface:MUCRoom
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.- Specified by:
addModerator
in interfaceMUCRoom
- Parameters:
jid
- The full JID of the occupant to give moderator privileges (cannot benull
).senderRole
- The role of the user that is granting moderator privileges to an occupant (cannot benull
).- 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
public org.xmpp.packet.Presence addParticipant(org.xmpp.packet.JID jid, String reason, MUCRole senderRole) throws NotAllowedException, ForbiddenException
Description copied from interface:MUCRoom
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.- Specified by:
addParticipant
in interfaceMUCRoom
- Parameters:
jid
- The full JID of the occupant to give participant privileges (cannot benull
).reason
- The reason why participant privileges were gave to the user ornull
if none.senderRole
- The role of the user that is granting participant privileges to an occupant (cannot benull
).- 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
public org.xmpp.packet.Presence addVisitor(org.xmpp.packet.JID jid, MUCRole senderRole) throws NotAllowedException, ForbiddenException
Description copied from interface:MUCRoom
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.- Specified by:
addVisitor
in interfaceMUCRoom
- Parameters:
jid
- the full JID of the occupant to change to visitor (cannot benull
).senderRole
- the role of the user that is changing the role to visitor (cannot benull
).- 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.
-
kickOccupant
public org.xmpp.packet.Presence kickOccupant(org.xmpp.packet.JID jid, org.xmpp.packet.JID actorJID, String actorNickname, String reason) throws NotAllowedException
Description copied from interface:MUCRoom
Kicks a user from the room. If the user was in the room, the returned updated presence will be sent to the remaining occupants.- Specified by:
kickOccupant
in interfaceMUCRoom
- Parameters:
jid
- The full JID of the kicked user (cannot benull
).actorJID
- The JID of the actor that initiated the kick (cannot benull
).actorNickname
- The actor nickname.reason
- An optional reason why the user was kicked (can benull
).- 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.
-
canAnyoneDiscoverJID
public boolean canAnyoneDiscoverJID()
Description copied from interface:MUCRoom
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.- Specified by:
canAnyoneDiscoverJID
in interfaceMUCRoom
- Returns:
- true if every presence packet will include the JID of every occupant.
-
setCanAnyoneDiscoverJID
public void setCanAnyoneDiscoverJID(boolean canAnyoneDiscoverJID)
Description copied from interface:MUCRoom
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.- Specified by:
setCanAnyoneDiscoverJID
in interfaceMUCRoom
- Parameters:
canAnyoneDiscoverJID
- boolean that specifies if every presence packet will include the JID of every occupant.
-
canSendPrivateMessage
public String canSendPrivateMessage()
Description copied from interface:MUCRoom
Returns the minimal role of persons that are allowed to send private messages in the room. The returned value is any one of: "anyone", "moderators", "participants", "none".- Specified by:
canSendPrivateMessage
in interfaceMUCRoom
- Returns:
- The minimal role of persons that are allowed to send private messages in the room (never null).
-
setCanSendPrivateMessage
public void setCanSendPrivateMessage(String role)
Description copied from interface:MUCRoom
Sets the minimal role of persons that are allowed to send private messages in the room. The provided value is any one of: "anyone", "moderators", "participants", "none". If another value is set, "anyone" is used instead.- Specified by:
setCanSendPrivateMessage
in interfaceMUCRoom
- Parameters:
role
- The minimal role of persons that are allowed to send private messages in the room (never null).
-
canOccupantsChangeSubject
public boolean canOccupantsChangeSubject()
Description copied from interface:MUCRoom
Returns true if participants are allowed to change the room's subject.- Specified by:
canOccupantsChangeSubject
in interfaceMUCRoom
- Returns:
- true if participants are allowed to change the room's subject.
-
setCanOccupantsChangeSubject
public void setCanOccupantsChangeSubject(boolean canOccupantsChangeSubject)
Description copied from interface:MUCRoom
Sets if participants are allowed to change the room's subject.- Specified by:
setCanOccupantsChangeSubject
in interfaceMUCRoom
- Parameters:
canOccupantsChangeSubject
- boolean that specifies if participants are allowed to change the room's subject.
-
canOccupantsInvite
public boolean canOccupantsInvite()
Description copied from interface:MUCRoom
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.- Specified by:
canOccupantsInvite
in interfaceMUCRoom
- Returns:
- true if occupants can invite other users to the room.
-
setCanOccupantsInvite
public void setCanOccupantsInvite(boolean canOccupantsInvite)
Description copied from interface:MUCRoom
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.- Specified by:
setCanOccupantsInvite
in interfaceMUCRoom
- Parameters:
canOccupantsInvite
- boolean that specified in any occupant can invite other users to the room.
-
getNaturalLanguageName
public String getNaturalLanguageName()
Description copied from interface:MUCRoom
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.- Specified by:
getNaturalLanguageName
in interfaceMUCRoom
- Returns:
- the natural language name of the room.
-
setNaturalLanguageName
public void setNaturalLanguageName(String naturalLanguageName)
Description copied from interface:MUCRoom
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.- Specified by:
setNaturalLanguageName
in interfaceMUCRoom
- Parameters:
naturalLanguageName
- the natural language name of the room.
-
getDescription
public String getDescription()
Description copied from interface:MUCRoom
Returns a description set by the room's owners about the room. This information will be used when discovering extended information about the room.- Specified by:
getDescription
in interfaceMUCRoom
- Returns:
- a description set by the room's owners about the room.
-
setDescription
public void setDescription(String description)
Description copied from interface:MUCRoom
Sets a description set by the room's owners about the room. This information will be used when discovering extended information about the room.- Specified by:
setDescription
in interfaceMUCRoom
- Parameters:
description
- a description set by the room's owners about the room.
-
isMembersOnly
public boolean isMembersOnly()
Description copied from interface:MUCRoom
Returns true if the room requires an invitation to enter. That is if the room is members-only.- Specified by:
isMembersOnly
in interfaceMUCRoom
- Returns:
- true if the room requires an invitation to enter.
-
setMembersOnly
public List<org.xmpp.packet.Presence> setMembersOnly(boolean membersOnly)
Description copied from interface:MUCRoom
Sets if the room requires an invitation to enter. That is if the room is members-only.- Specified by:
setMembersOnly
in interfaceMUCRoom
- 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
public boolean isLogEnabled()
Description copied from interface:MUCRoom
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.- Specified by:
isLogEnabled
in interfaceMUCRoom
- Returns:
- true if the room's conversation is being logged.
-
setLogEnabled
public void setLogEnabled(boolean logEnabled)
Description copied from interface:MUCRoom
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.- Specified by:
setLogEnabled
in interfaceMUCRoom
- Parameters:
logEnabled
- boolean that specified if the room's conversation must be logged.
-
setLoginRestrictedToNickname
public void setLoginRestrictedToNickname(boolean restricted)
Description copied from interface:MUCRoom
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.- Specified by:
setLoginRestrictedToNickname
in interfaceMUCRoom
- Parameters:
restricted
- if registered users can only join the room using their registered nickname.
-
isLoginRestrictedToNickname
public boolean isLoginRestrictedToNickname()
Description copied from interface:MUCRoom
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.- Specified by:
isLoginRestrictedToNickname
in interfaceMUCRoom
- Returns:
- true if registered users can only join the room using their registered nickname.
-
setChangeNickname
public void setChangeNickname(boolean canChange)
Description copied from interface:MUCRoom
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.
- Specified by:
setChangeNickname
in interfaceMUCRoom
- Parameters:
canChange
- if room occupants are allowed to change their nicknames in the room.
-
canChangeNickname
public boolean canChangeNickname()
Description copied from interface:MUCRoom
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.
- Specified by:
canChangeNickname
in interfaceMUCRoom
- Returns:
- true if room occupants are allowed to change their nicknames in the room.
-
setRegistrationEnabled
public void setRegistrationEnabled(boolean registrationEnabled)
Description copied from interface:MUCRoom
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.- Specified by:
setRegistrationEnabled
in interfaceMUCRoom
- Parameters:
registrationEnabled
- if users are allowed to register with the room.
-
isRegistrationEnabled
public boolean isRegistrationEnabled()
Description copied from interface:MUCRoom
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.- Specified by:
isRegistrationEnabled
in interfaceMUCRoom
- Returns:
- true if users are allowed to register with the room.
-
setFmucEnabled
public void setFmucEnabled(boolean fmucEnabled)
Description copied from interface:MUCRoom
Sets if this room accepts FMUC joins. By default, FMUC functionality is not enabled. When joining nodes are attempting a join, a rejection will be returned when this feature is disabled.- Specified by:
setFmucEnabled
in interfaceMUCRoom
-
isFmucEnabled
public boolean isFmucEnabled()
Description copied from interface:MUCRoom
Returns true if this room accepts FMUC joins. By default, FMUC functionality is not enabled. When joining nodes are attempting a join, a rejection will be returned when this feature is disabled.- Specified by:
isFmucEnabled
in interfaceMUCRoom
-
getMaxUsers
public int getMaxUsers()
Description copied from interface:MUCRoom
Returns the maximum number of occupants that can be simultaneously in the room. If the number is zero then there is no limit.- Specified by:
getMaxUsers
in interfaceMUCRoom
- Returns:
- the maximum number of occupants that can be simultaneously in the room. Zero means unlimited number of occupants.
-
setMaxUsers
public void setMaxUsers(int maxUsers)
Description copied from interface:MUCRoom
Sets the maximum number of occupants that can be simultaneously in the room. If the number is zero then there is no limit.- Specified by:
setMaxUsers
in interfaceMUCRoom
- Parameters:
maxUsers
- the maximum number of occupants that can be simultaneously in the room. Zero means unlimited number of occupants.
-
isModerated
public boolean isModerated()
Description copied from interface:MUCRoom
Returns if the room in which only those with "voice" may send messages to all occupants.- Specified by:
isModerated
in interfaceMUCRoom
- Returns:
- if the room in which only those with "voice" may send messages to all occupants.
-
setModerated
public void setModerated(boolean moderated)
Description copied from interface:MUCRoom
Sets if the room in which only those with "voice" may send messages to all occupants.- Specified by:
setModerated
in interfaceMUCRoom
- Parameters:
moderated
- if the room in which only those with "voice" may send messages to all occupants.
-
getPassword
public String getPassword()
Description copied from interface:MUCRoom
Returns the password that the user must provide to enter the room.- Specified by:
getPassword
in interfaceMUCRoom
- Returns:
- the password that the user must provide to enter the room.
-
setPassword
public void setPassword(String password)
Description copied from interface:MUCRoom
Sets the password that the user must provide to enter the room.- Specified by:
setPassword
in interfaceMUCRoom
- Parameters:
password
- the password that the user must provide to enter the room.
-
isPasswordProtected
public boolean isPasswordProtected()
Description copied from interface:MUCRoom
Returns true if a user cannot enter without first providing the correct password.- Specified by:
isPasswordProtected
in interfaceMUCRoom
- Returns:
- true if a user cannot enter without first providing the correct password.
-
isPersistent
public boolean isPersistent()
Description copied from interface:MUCRoom
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.- Specified by:
isPersistent
in interfaceMUCRoom
- Returns:
- true if the room is not destroyed if the last occupant exits.
-
wasSavedToDB
public boolean wasSavedToDB()
Description copied from interface:MUCRoom
Returns true if the room has already been made persistent. If the room is temporary the answer will always be false.- Specified by:
wasSavedToDB
in interfaceMUCRoom
- Returns:
- true if the room has already been made persistent.
-
setSavedToDB
public void setSavedToDB(boolean saved)
Description copied from interface:MUCRoom
Sets if the room has already been made persistent.- Specified by:
setSavedToDB
in interfaceMUCRoom
- Parameters:
saved
- boolean that indicates if the room was saved to the database.
-
setPersistent
public void setPersistent(boolean persistent)
Description copied from interface:MUCRoom
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.- Specified by:
setPersistent
in interfaceMUCRoom
- Parameters:
persistent
- if the room is not destroyed if the last occupant exits.
-
isPublicRoom
public boolean isPublicRoom()
Description copied from interface:MUCRoom
Returns true if the room is searchable and visible through service discovery.- Specified by:
isPublicRoom
in interfaceMUCRoom
- Returns:
- true if the room is searchable and visible through service discovery.
-
setPublicRoom
public void setPublicRoom(boolean publicRoom)
Description copied from interface:MUCRoom
Sets if the room is searchable and visible through service discovery.- Specified by:
setPublicRoom
in interfaceMUCRoom
- Parameters:
publicRoom
- if the room is searchable and visible through service discovery.
-
getRolesToBroadcastPresence
public List<String> getRolesToBroadcastPresence()
Description copied from interface:MUCRoom
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.- Specified by:
getRolesToBroadcastPresence
in interfaceMUCRoom
- Returns:
- the list of roles of which presence will be broadcasted to the rest of the occupants.
-
setRolesToBroadcastPresence
public void setRolesToBroadcastPresence(List<String> rolesToBroadcastPresence)
Description copied from interface:MUCRoom
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.- Specified by:
setRolesToBroadcastPresence
in interfaceMUCRoom
- Parameters:
rolesToBroadcastPresence
- the list of roles of which presence will be broadcasted to the rest of the occupants.
-
canBroadcastPresence
public boolean canBroadcastPresence(String roleToBroadcast)
Description copied from interface:MUCRoom
Returns true if the presences of the requested role will be broadcasted.- Specified by:
canBroadcastPresence
in interfaceMUCRoom
- 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
public void lock(MUCRole senderRole) throws ForbiddenException
Description copied from interface:MUCRoom
Locks the room so that users cannot join the room. Only the owner of the room can lock/unlock the room.- Specified by:
lock
in interfaceMUCRoom
- Parameters:
senderRole
- the role of the occupant that locked the room.- Throws:
ForbiddenException
- If the user is not an owner of the room.
-
unlock
public void unlock(MUCRole senderRole) throws ForbiddenException
Description copied from interface:MUCRoom
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.- Specified by:
unlock
in interfaceMUCRoom
- Parameters:
senderRole
- the role of the occupant that unlocked the room.- Throws:
ForbiddenException
- If the user is not an owner of the room.
-
addAdmins
public List<org.xmpp.packet.Presence> addAdmins(List<org.xmpp.packet.JID> newAdmins, MUCRole senderRole) throws ForbiddenException, ConflictException
Description copied from interface:MUCRoom
Adds a list of users to the list of admins.- Specified by:
addAdmins
in interfaceMUCRoom
- Parameters:
newAdmins
- the list of bare JIDs of the users to add to the list of existing admins (cannot benull
).senderRole
- the role of the user that is trying to modify the admins list (cannot benull
).- 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.
-
addOwners
public List<org.xmpp.packet.Presence> addOwners(List<org.xmpp.packet.JID> newOwners, MUCRole senderRole) throws ForbiddenException
Description copied from interface:MUCRoom
Adds a list of users to the list of owners.- Specified by:
addOwners
in interfaceMUCRoom
- Parameters:
newOwners
- the list of bare JIDs of the users to add to the list of existing owners (cannot benull
).senderRole
- the role of the user that is trying to modify the owners list (cannot benull
).- 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.
-
saveToDB
public void saveToDB()
Description copied from interface:MUCRoom
Saves the room configuration to the DB. After the room has been saved to the DB it will become persistent.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
updateConfiguration
public void updateConfiguration(LocalMUCRoom otherRoom)
-
getUID
public String getUID()
- Specified by:
getUID
in interfaceorg.xmpp.resultsetmanagement.Result
-
groupDeleting
public void groupDeleting(Group group, Map params)
Description copied from interface:GroupEventListener
A group is being deleted.- Specified by:
groupDeleting
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
groupModified
public void groupModified(Group group, Map params)
Description copied from interface:GroupEventListener
A group's name, description, or an extended property was changed.- Specified by:
groupModified
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
memberAdded
public void memberAdded(Group group, Map params)
Description copied from interface:GroupEventListener
A member was added to a group.- Specified by:
memberAdded
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
memberRemoved
public void memberRemoved(Group group, Map params)
Description copied from interface:GroupEventListener
A member was removed from a group.- Specified by:
memberRemoved
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
adminAdded
public void adminAdded(Group group, Map params)
Description copied from interface:GroupEventListener
An administrator was added to a group.- Specified by:
adminAdded
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
adminRemoved
public void adminRemoved(Group group, Map params)
Description copied from interface:GroupEventListener
An administrator was removed from a group.- Specified by:
adminRemoved
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
groupCreated
public void groupCreated(Group group, Map params)
Description copied from interface:GroupEventListener
A group was created.- Specified by:
groupCreated
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
-