Class FallbackIndicationManager
java.lang.Object
org.jivesoftware.smack.Manager
org.jivesoftware.smackx.fallback_indication.FallbackIndicationManager
Smacks API for XEP-0428: Fallback Indication.
In some scenarios it might make sense to mark the body of a message as fallback for legacy clients.
Examples are encryption mechanisms where the sender might include a hint for legacy clients stating that the
body (eg. "This message is encrypted") should be ignored.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageBuilder
addFallbackIndication
(MessageBuilder messageBuilder) Add aFallbackIndicationElement
to the provided message builder.void
Register aFallbackIndicationListener
that gets notified whenever a message that contains aFallbackIndicationElement
is received.static MessageBuilder
addFallbackIndicationWithBody
(MessageBuilder messageBuilder, String fallbackMessageBody) Set the body of the message to the provided fallback message and add aFallbackIndicationElement
.static FallbackIndicationManager
getInstanceFor
(XMPPConnection connection) void
Unregister aFallbackIndicationListener
.boolean
Determine, whether or not the server supports Fallback Indications.boolean
Determine, whether or not a user supports Fallback Indications.Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
Method Details
-
getInstanceFor
-
userSupportsFallbackIndications
public boolean userSupportsFallbackIndications(EntityBareJid jid) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException Determine, whether or not a user supports Fallback Indications.- Parameters:
jid
- BareJid of the user.- Returns:
- feature support
- Throws:
XMPPException.XMPPErrorException
- if a protocol level error happensSmackException.NotConnectedException
- if the connection is not connectedInterruptedException
- if the thread is being interruptedSmackException.NoResponseException
- if the server doesn't send a response in time
-
serverSupportsFallbackIndications
public boolean serverSupportsFallbackIndications() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseExceptionDetermine, whether or not the server supports Fallback Indications.- Returns:
- server side feature support
- Throws:
XMPPException.XMPPErrorException
- if a protocol level error happensSmackException.NotConnectedException
- if the connection is not connectedInterruptedException
- if the thread is being interruptedSmackException.NoResponseException
- if the server doesn't send a response in time
-
addFallbackIndicationWithBody
public static MessageBuilder addFallbackIndicationWithBody(MessageBuilder messageBuilder, String fallbackMessageBody) Set the body of the message to the provided fallback message and add aFallbackIndicationElement
.- Parameters:
messageBuilder
- message builderfallbackMessageBody
- fallback message body- Returns:
- builder with set body and added fallback element
-
addFallbackIndication
Add aFallbackIndicationElement
to the provided message builder.- Parameters:
messageBuilder
- message builder- Returns:
- message builder with added fallback element
-
addFallbackIndicationListener
Register aFallbackIndicationListener
that gets notified whenever a message that contains aFallbackIndicationElement
is received.- Parameters:
listener
- listener to be registered.
-
removeFallbackIndicationListener
Unregister aFallbackIndicationListener
.- Parameters:
listener
- listener to be unregistered.
-