Package rocks.xmpp.extensions.rtt
Class RealTimeTextManager
- java.lang.Object
-
- rocks.xmpp.extensions.rtt.RealTimeTextManager
-
- All Implemented Interfaces:
ExtensionProtocol
,InboundMessageHandler
,DiscoverableInfo
public final class RealTimeTextManager extends Object implements InboundMessageHandler, ExtensionProtocol, DiscoverableInfo
Manages In-Band Real Time Text.- See Also:
- XEP-0301: In-Band Real Time Text
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(Chat chat)
Activates real-time text for a chat session.void
addRealTimeMessageListener(Consumer<RealTimeMessageEvent> realTimeMessageListener)
Adds a real-time message listener, which allows to listen for new inbound real-time messages.void
addRealTimeTextActivationListener(Consumer<RealTimeTextActivationEvent> realTimeTextListener)
Adds a real-time text listener, which allows to listen for real-time text.OutboundRealTimeMessage
createRealTimeMessage(Chat chat)
Creates a new real-time message for sending real-time text.OutboundRealTimeMessage
createRealTimeMessage(Chat chat, String id)
Creates a new real-time message for sending real-time text.void
deactivate(Chat chat)
Deactivates real-time text for a chat session.Set<String>
getFeatures()
Gets the features.String
getNamespace()
The protocol's main namespace.void
handleInboundMessage(MessageEvent e)
Handles an inbound message.boolean
isEnabled()
Indicates whether this protocol is enabled.void
removeRealTimeTextActivationListener(Consumer<RealTimeTextActivationEvent> realTimeTextListener)
Removes a previously added real-time text 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
-
createRealTimeMessage
public final OutboundRealTimeMessage createRealTimeMessage(Chat chat, String id)
Creates a new real-time message for sending real-time text. This method is intended for creating a new message, when editing an existing message, when used in concert with XEP-0308: Last Message Correction.- Parameters:
chat
- The chat to send real-time text with.id
- The id of the message, which is edited with a real-time message.- Returns:
- The real-time message.
- See Also:
Replace
-
createRealTimeMessage
public final OutboundRealTimeMessage createRealTimeMessage(Chat chat)
Creates a new real-time message for sending real-time text.- Parameters:
chat
- The chat to send real-time text with.- Returns:
- The real-time message.
-
addRealTimeMessageListener
public final void addRealTimeMessageListener(Consumer<RealTimeMessageEvent> realTimeMessageListener)
Adds a real-time message listener, which allows to listen for new inbound real-time messages.- Parameters:
realTimeMessageListener
- The listener.
-
addRealTimeTextActivationListener
public final void addRealTimeTextActivationListener(Consumer<RealTimeTextActivationEvent> realTimeTextListener)
Adds a real-time text listener, which allows to listen for real-time text.- Parameters:
realTimeTextListener
- The listener.- See Also:
removeRealTimeTextActivationListener(Consumer)
-
removeRealTimeTextActivationListener
public final void removeRealTimeTextActivationListener(Consumer<RealTimeTextActivationEvent> realTimeTextListener)
Removes a previously added real-time text listener.- Parameters:
realTimeTextListener
- The listener.- See Also:
addRealTimeTextActivationListener(Consumer)
-
activate
public final void activate(Chat chat)
Activates real-time text for a chat session.- Parameters:
chat
- The chat.- See Also:
- 6.1 Activating Real-Time Text
-
deactivate
public final void deactivate(Chat chat)
Deactivates real-time text for a chat session.- Parameters:
chat
- The chat.- See Also:
- 6.2 Deactivating Real-Time Text
-
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.
-
getNamespace
public final String getNamespace()
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- "urn:xmpp:rtt:0"
-
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.
-
-