Package rocks.xmpp.extensions.muc
Class MultiUserChatManager
- java.lang.Object
-
- rocks.xmpp.extensions.muc.MultiUserChatManager
-
- All Implemented Interfaces:
ExtensionProtocol,InboundMessageHandler,DiscoverableInfo,ItemProvider
public final class MultiUserChatManager extends Object implements InboundMessageHandler, ItemProvider, ExtensionProtocol, DiscoverableInfo
Manages Multi-User Chat.- See Also:
- XEP-0045: Multi-User Chat
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInvitationListener(Consumer<InvitationEvent> invitationListener)Adds an invitation listener, which allows to listen for inbound multi-user chat invitations.ChatRoomcreateChatRoom(Jid roomAddress)Creates a chat room for the specified room address.ChatServicecreateChatService(Jid chatService)Creates a chat service for the specified service address.AsyncResult<List<ChatService>>discoverChatServices()Discovers the multi-user chat services hosted at the connected domain.AsyncResult<List<Item>>discoverEnteredRooms(Jid contact)Discovers the rooms, where a contact is in.Set<String>getFeatures()Gets the features.ResultSetProvider<DiscoverableItem>getItems(Jid to, Jid from, String node, Locale locale)Provides the result set of items, in order to manage the result set returned to the requesting entity.StringgetNamespace()The protocol's main namespace.voidhandleInboundMessage(MessageEvent e)Handles an inbound message.booleanisEnabled()Indicates whether this protocol is enabled.voidremoveInvitationListener(Consumer<InvitationEvent> invitationListener)Removes a previously added invitation listener.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface rocks.xmpp.extensions.disco.model.info.DiscoverableInfo
getExtensions, getIdentities
-
-
-
-
Method Detail
-
addInvitationListener
public void addInvitationListener(Consumer<InvitationEvent> invitationListener)
Adds an invitation listener, which allows to listen for inbound multi-user chat invitations.- Parameters:
invitationListener- The listener.- See Also:
removeInvitationListener(Consumer)
-
removeInvitationListener
public void removeInvitationListener(Consumer<InvitationEvent> invitationListener)
Removes a previously added invitation listener.- Parameters:
invitationListener- The listener.- See Also:
addInvitationListener(Consumer)
-
discoverChatServices
public AsyncResult<List<ChatService>> discoverChatServices()
Discovers the multi-user chat services hosted at the connected domain.- Returns:
- The async result with the list of chat services.
- See Also:
- 6.1 Discovering a MUC Service
-
discoverEnteredRooms
public AsyncResult<List<Item>> discoverEnteredRooms(Jid contact)
Discovers the rooms, where a contact is in.- Parameters:
contact- The contact, which must be a full JID.- Returns:
- The async result with the items,
Addressable.getJid()has the room address, andItem.getName()} has the nickname. - See Also:
- 6.7 Discovering Client Support for MUC
-
createChatService
public ChatService createChatService(Jid chatService)
Creates a chat service for the specified service address.- Parameters:
chatService- The chat service address. Usually this is hosted at the subdomain "conference".- Returns:
- The chat service.
-
createChatRoom
public ChatRoom createChatRoom(Jid roomAddress)
Creates a chat room for the specified room address.- Parameters:
roomAddress- The chat room address.- Returns:
- The chat room.
-
getItems
public ResultSetProvider<DiscoverableItem> getItems(Jid to, Jid from, String node, Locale locale)
Description copied from interface:ItemProviderProvides the result set of items, in order to manage the result set returned to the requesting entity. Requesting entities may include result set information in their request, e.g. to limit the returned items.If this method returns null and not other providers are found which return a non-null result for the same parameters, then
Condition.ITEM_NOT_FOUNDis returned to the requesting entity.- Specified by:
getItemsin interfaceItemProvider- Parameters:
to- The receiving entity.from- The requesting entity.node- The requested node, if any. May be null.locale- The locale of the requesting entity's stream or stanza.- Returns:
- The result set provider or null, if no result set can be returned for the given parameters.
-
getNamespace
public final String getNamespace()
Description copied from interface:ExtensionProtocolThe protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespacein interfaceExtensionProtocol- Returns:
- The main namespace.
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocolIndicates whether this protocol is enabled.- Specified by:
isEnabledin interfaceExtensionProtocol- Returns:
- true, if enabled; false if disabled.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfoGets the features.- Specified by:
getFeaturesin interfaceDiscoverableInfo- Returns:
- The features.
-
handleInboundMessage
public final void handleInboundMessage(MessageEvent e)
Description copied from interface:InboundMessageHandlerHandles an inbound message.- Specified by:
handleInboundMessagein interfaceInboundMessageHandler- Parameters:
e- The message event.
-
-