Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.muc
Interface MultiUserChatService

All Superinterfaces:
org.xmpp.component.Component
All Known Implementing Classes:
MultiUserChatServiceImpl

public interface MultiUserChatService
extends org.xmpp.component.Component

Manages groupchat conversations, chatrooms, and users. This class is designed to operate independently from the rest of the Jive server infrastruture. This theoretically allows deployment of the groupchat on a separate server from the main IM server.

Author:
Gaston Dombiak

Method Summary
 void addSysadmin(org.xmpp.packet.JID userJID)
          Adds a new system administrator of the MUC service.
 void addUserAllowedToCreate(org.xmpp.packet.JID userJID)
          Adds a new user to the list of JIDs that are allowed to create MUC rooms.
 void addUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
          Adds new users to the list of JIDs that are allowed to create MUC rooms.
 void chatRoomAdded(LocalMUCRoom room)
          Notification message indicating that a chat room has been created in another cluster member.
 void chatRoomRemoved(LocalMUCRoom room)
          Notification message indicating that the specified chat room was removed from some other cluster member.
 void enableService(boolean enabled, boolean persistent)
          Enables or disables the MUC service.
 MUCRoom getChatRoom(String roomName)
          Obtains a chatroom by name.
 MUCRoom getChatRoom(String roomName, org.xmpp.packet.JID userjid)
          Obtains a chatroom by name.
 List<MUCRoom> getChatRooms()
          Retuns a list with a snapshot of all the rooms in the server (i.e.
 HistoryStrategy getHistoryStrategy()
          Obtain the server-wide default message history settings.
 long getIncomingMessageCount(boolean resetAfter)
          Returns the total number of incoming messages since last reset.
 int getKickIdleUsersTimeout()
          Returns the time to elapse between clearing of idle chat users.
 int getLogConversationBatchSize()
          Returns the number of messages to save to the database on each run of the logging process.
 int getLogConversationsTimeout()
          Returns the time to elapse between logging the room conversations.
 Collection<MUCRole> getMUCRoles(org.xmpp.packet.JID user)
          Returns the list of MUCRole in all rooms for the specified user's session.
 int getNumberChatRooms()
          Retuns the number of existing rooms in the server (i.e.
 int getNumberConnectedUsers(boolean onlyLocal)
          Retuns the total number of occupants in all rooms in the server.
 int getNumberRoomOccupants()
          Retuns the total number of users that have joined in all rooms in the server.
 long getOutgoingMessageCount(boolean resetAfter)
          Returns the total number of outgoing messages since last reset.
 String getServiceDomain()
          Returns the fully-qualifed domain name of this chat service.
 String getServiceName()
          Returns the subdomain of the chat service.
 Collection<org.xmpp.packet.JID> getSysadmins()
          Returns the collection of JIDs that are system administrators of the MUC service.
 long getTotalChatTime()
          Returns the total chat time of all rooms combined.
 int getUserIdleTime()
          Returns the number of milliseconds a user must be idle before he/she gets kicked from all the rooms.
 Collection<org.xmpp.packet.JID> getUsersAllowedToCreate()
          Returns the collection of JIDs that are allowed to create MUC rooms.
 boolean hasChatRoom(String roomName)
          Returns true if the server includes a chatroom with the requested name.
 boolean isHidden()
          Returns true if the MUC service is a hidden, externally managed, service.
 boolean isRoomCreationRestricted()
          Returns false if anyone can create rooms or true if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.
 boolean isServiceEnabled()
          Returns true if the MUC service is available.
 void logConversation(MUCRoom room, org.xmpp.packet.Message message, org.xmpp.packet.JID sender)
          Logs that a given message was sent to a room as part of a conversation.
 void messageBroadcastedTo(int numOccupants)
          Notification message indicating the server that an incoming message was broadcasted to a given number of occupants.
 void refreshChatRoom(String roomName)
          Forces a re-read of the room.
 void removeChatRoom(String roomName)
          Removes the room associated with the given name.
 void removeSysadmin(org.xmpp.packet.JID userJID)
          Removes a system administrator of the MUC service.
 void removeUserAllowedToCreate(org.xmpp.packet.JID userJID)
          Removes a user from list of JIDs that are allowed to create MUC rooms.
 void removeUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
          Removes users from list of JIDs that are allowed to create MUC rooms.
 void setKickIdleUsersTimeout(int timeout)
          Sets the time to elapse between clearing of idle chat users.
 void setLogConversationBatchSize(int size)
          Sets the number of messages to save to the database on each run of the logging process.
 void setLogConversationsTimeout(int timeout)
          Sets the time to elapse between logging the room conversations.
 void setRoomCreationRestricted(boolean roomCreationRestricted)
          Sets if anyone can create rooms or if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.
 void setUserIdleTime(int idle)
          Sets the number of milliseconds a user must be idle before he/she gets kicked from all the rooms.
 
Methods inherited from interface org.xmpp.component.Component
getDescription, getName, initialize, processPacket, shutdown, start
 

Method Detail

getServiceDomain

String getServiceDomain()
Returns the fully-qualifed domain name of this chat service. The domain is composed by the service name and the name of the XMPP server where the service is running.

Returns:
the chat server domain (service name + host name).

getServiceName

String getServiceName()
Returns the subdomain of the chat service.

Returns:
the subdomain of the chat service.

getSysadmins

Collection<org.xmpp.packet.JID> getSysadmins()
Returns the collection of JIDs that are system administrators of the MUC service. A sysadmin has the same permissions as a room owner.

Returns:
a list of bare JIDs.

addSysadmin

void addSysadmin(org.xmpp.packet.JID userJID)
Adds a new system administrator of the MUC service. A sysadmin has the same permissions as a room owner.

Parameters:
userJID - the bare JID of the new user to add as a system administrator.

removeSysadmin

void removeSysadmin(org.xmpp.packet.JID userJID)
Removes a system administrator of the MUC service.

Parameters:
userJID - the bare JID of the user to remove from the list.

isRoomCreationRestricted

boolean isRoomCreationRestricted()
Returns false if anyone can create rooms or true if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.

Returns:
true if only some JIDs are allowed to create rooms.

setRoomCreationRestricted

void setRoomCreationRestricted(boolean roomCreationRestricted)
Sets if anyone can create rooms or if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.

Parameters:
roomCreationRestricted - whether anyone can create rooms or not.

getUsersAllowedToCreate

Collection<org.xmpp.packet.JID> getUsersAllowedToCreate()
Returns the collection of JIDs that are allowed to create MUC rooms. An empty list means that anyone can create a room.

Returns:
a list of bare JIDs.

addUserAllowedToCreate

void addUserAllowedToCreate(org.xmpp.packet.JID userJID)
Adds a new user to the list of JIDs that are allowed to create MUC rooms.

Parameters:
userJID - the bare JID of the new user to add to list.

addUsersAllowedToCreate

void addUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
Adds new users to the list of JIDs that are allowed to create MUC rooms.

Parameters:
userJIDs - collection of bare JIDs if users to add to list.

removeUserAllowedToCreate

void removeUserAllowedToCreate(org.xmpp.packet.JID userJID)
Removes a user from list of JIDs that are allowed to create MUC rooms.

Parameters:
userJID - the bare JID of the user to remove from the list.

removeUsersAllowedToCreate

void removeUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
Removes users from list of JIDs that are allowed to create MUC rooms.

Parameters:
userJIDs - collection of bare JIDs of users to remove from the list.

setKickIdleUsersTimeout

void setKickIdleUsersTimeout(int timeout)
Sets the time to elapse between clearing of idle chat users. A TimerTask will be added to a Timer scheduled for repeated fixed-delay execution whose main responsibility is to kick users that have been idle for a certain time. A user is considered idle if he/she didn't send any message to any group chat room for a certain amount of time. See setUserIdleTime(int).

Parameters:
timeout - the time to elapse between clearing of idle chat users.

getKickIdleUsersTimeout

int getKickIdleUsersTimeout()
Returns the time to elapse between clearing of idle chat users. A user is considered idle if he/she didn't send any message to any group chat room for a certain amount of time. See getUserIdleTime().

Returns:
the time to elapse between clearing of idle chat users.

setUserIdleTime

void setUserIdleTime(int idle)
Sets the number of milliseconds a user must be idle before he/she gets kicked from all the rooms. By idle we mean that the user didn't send any message to any group chat room.

Parameters:
idle - the amount of time to wait before considering a user idle.

getUserIdleTime

int getUserIdleTime()
Returns the number of milliseconds a user must be idle before he/she gets kicked from all the rooms. By idle we mean that the user didn't send any message to any group chat room.

Returns:
the amount of time to wait before considering a user idle.

setLogConversationsTimeout

void setLogConversationsTimeout(int timeout)
Sets the time to elapse between logging the room conversations. A TimerTask will be added to a Timer scheduled for repeated fixed-delay execution whose main responsibility is to log queued rooms conversations. The number of queued conversations to save on each run can be configured. See setLogConversationBatchSize(int).

Parameters:
timeout - the time to elapse between logging the room conversations.

getLogConversationsTimeout

int getLogConversationsTimeout()
Returns the time to elapse between logging the room conversations. A TimerTask will be added to a Timer scheduled for repeated fixed-delay execution whose main responsibility is to log queued rooms conversations. The number of queued conversations to save on each run can be configured. See getLogConversationBatchSize().

Returns:
the time to elapse between logging the room conversations.

setLogConversationBatchSize

void setLogConversationBatchSize(int size)
Sets the number of messages to save to the database on each run of the logging process. Even though the saving of queued conversations takes place in another thread it is not recommended specifying a big number.

Parameters:
size - the number of messages to save to the database on each run of the logging process.

getLogConversationBatchSize

int getLogConversationBatchSize()
Returns the number of messages to save to the database on each run of the logging process.

Returns:
the number of messages to save to the database on each run of the logging process.

getHistoryStrategy

HistoryStrategy getHistoryStrategy()
Obtain the server-wide default message history settings.

Returns:
The message history strategy defaults for the server.

getChatRoom

MUCRoom getChatRoom(String roomName,
                    org.xmpp.packet.JID userjid)
                    throws NotAllowedException
Obtains a chatroom by name. A chatroom is created for that name if none exists and the user has permission. The user that asked for the chatroom will be the room's owner if the chatroom was created.

Parameters:
roomName - Name of the room to get.
userjid - The user's normal jid, not the chat nickname jid.
Returns:
The chatroom for the given name.
Throws:
NotAllowedException - If the caller doesn't have permission to create a new room.

getChatRoom

MUCRoom getChatRoom(String roomName)
Obtains a chatroom by name. If the chatroom does not exists then null will be returned.

Parameters:
roomName - Name of the room to get.
Returns:
The chatroom for the given name or null if the room does not exists.

refreshChatRoom

void refreshChatRoom(String roomName)
Forces a re-read of the room. Useful when a change occurs externally.

Parameters:
roomName - Name of the room to refresh.

getChatRooms

List<MUCRoom> getChatRooms()
Retuns a list with a snapshot of all the rooms in the server (i.e. persistent or not, in memory or not).

Returns:
a list with a snapshot of all the rooms.

hasChatRoom

boolean hasChatRoom(String roomName)
Returns true if the server includes a chatroom with the requested name.

Parameters:
roomName - the name of the chatroom to check.
Returns:
true if the server includes a chatroom with the requested name.

chatRoomRemoved

void chatRoomRemoved(LocalMUCRoom room)
Notification message indicating that the specified chat room was removed from some other cluster member.

Parameters:
room - the removed room in another cluster node.

chatRoomAdded

void chatRoomAdded(LocalMUCRoom room)
Notification message indicating that a chat room has been created in another cluster member.

Parameters:
room - the created room in another cluster node.

removeChatRoom

void removeChatRoom(String roomName)
Removes the room associated with the given name.

Parameters:
roomName - The room to remove.

getMUCRoles

Collection<MUCRole> getMUCRoles(org.xmpp.packet.JID user)
Returns the list of MUCRole in all rooms for the specified user's session. When running in a cluster the list will include LocalMUCRole and RemoteMUCRole.

Parameters:
user - the full JID that identifies the session of the user.
Returns:
the list of MUCRoles in all rooms for the specified user's session.

getTotalChatTime

long getTotalChatTime()
Returns the total chat time of all rooms combined.

Returns:
total chat time in milliseconds.

getNumberChatRooms

int getNumberChatRooms()
Retuns the number of existing rooms in the server (i.e. persistent or not, in memory or not).

Returns:
the number of existing rooms in the server.

getNumberConnectedUsers

int getNumberConnectedUsers(boolean onlyLocal)
Retuns the total number of occupants in all rooms in the server.

Parameters:
onlyLocal - true if only users connected to this JVM will be considered. Otherwise count cluster wise.
Returns:
the number of existing rooms in the server.

getNumberRoomOccupants

int getNumberRoomOccupants()
Retuns the total number of users that have joined in all rooms in the server.

Returns:
the number of existing rooms in the server.

getIncomingMessageCount

long getIncomingMessageCount(boolean resetAfter)
Returns the total number of incoming messages since last reset.

Parameters:
resetAfter - True if you want the counter to be reset after results returned.
Returns:
the number of incoming messages through the service.

getOutgoingMessageCount

long getOutgoingMessageCount(boolean resetAfter)
Returns the total number of outgoing messages since last reset.

Parameters:
resetAfter - True if you want the counter to be reset after results returned.
Returns:
the number of outgoing messages through the service.

logConversation

void logConversation(MUCRoom room,
                     org.xmpp.packet.Message message,
                     org.xmpp.packet.JID sender)
Logs that a given message was sent to a room as part of a conversation. Every message sent to the room that is allowed to be broadcasted and that was sent either from the room itself or from an occupant will be logged.

Note: For performane reasons, the logged message won't be immediately saved. Instead we keep the logged messages in memory until the logging process saves them to the database. It's possible to configure the logging process to run every X milliseconds and also the number of messages to log on each execution.

Parameters:
room - the room that received the message.
message - the message to log as part of the conversation in the room.
sender - the real XMPPAddress of the sender (e.g. john@example.org).
See Also:
MultiUserChatServiceImpl.initialize(org.jivesoftware.openfire.XMPPServer)

messageBroadcastedTo

void messageBroadcastedTo(int numOccupants)
Notification message indicating the server that an incoming message was broadcasted to a given number of occupants.

Parameters:
numOccupants - number of occupants that received the message.

enableService

void enableService(boolean enabled,
                   boolean persistent)
Enables or disables the MUC service. When disabled the MUC service will disappear from the disco#items list. Moreover, service discovery features will be disabled.

Parameters:
enabled - true if the service is enabled.
persistent - true if the new setting will persist across restarts.

isServiceEnabled

boolean isServiceEnabled()
Returns true if the MUC service is available. Use enableService(boolean, boolean) to enable or disable the service.

Returns:
true if the MUC service is available.

isHidden

boolean isHidden()
Returns true if the MUC service is a hidden, externally managed, service. This is typically set to true when the implementation is not the default one, and is not to be managed by the standard Openfire interface. If this is set to true, the service will not show up in the service list in the admin console.

Returns:
true if the MUC service is hidden and externally managed.

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.