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 void
addInvitationListener(Consumer<InvitationEvent> invitationListener)
Adds an invitation listener, which allows to listen for inbound multi-user chat invitations.ChatRoom
createChatRoom(Jid roomAddress)
Creates a chat room for the specified room address.ChatService
createChatService(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.String
getNamespace()
The protocol's main namespace.void
handleInboundMessage(MessageEvent e)
Handles an inbound message.boolean
isEnabled()
Indicates whether this protocol is enabled.void
removeInvitationListener(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:ItemProvider
Provides 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_FOUND
is returned to the requesting entity.- Specified by:
getItems
in 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:ExtensionProtocol
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- The main namespace.
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocol
Indicates whether this protocol is enabled.- Specified by:
isEnabled
in interfaceExtensionProtocol
- Returns:
- true, if enabled; false if disabled.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
handleInboundMessage
public final void handleInboundMessage(MessageEvent e)
Description copied from interface:InboundMessageHandler
Handles an inbound message.- Specified by:
handleInboundMessage
in interfaceInboundMessageHandler
- Parameters:
e
- The message event.
-
-