Class FallbackIndicationManager
- java.lang.Object
-
- org.jivesoftware.smack.Manager
-
- org.jivesoftware.smackx.fallback_indication.FallbackIndicationManager
-
public final class FallbackIndicationManager extends Manager
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:
- XEP-0428: Fallback Indication
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MessageBuilder
addFallbackIndication(MessageBuilder messageBuilder)
Add aFallbackIndicationElement
to the provided message builder.void
addFallbackIndicationListener(FallbackIndicationListener listener)
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
removeFallbackIndicationListener(FallbackIndicationListener listener)
Unregister aFallbackIndicationListener
.boolean
serverSupportsFallbackIndications()
Determine, whether or not the server supports Fallback Indications.boolean
userSupportsFallbackIndications(EntityBareJid jid)
Determine, whether or not a user supports Fallback Indications.-
Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
-
-
-
Method Detail
-
getInstanceFor
public static FallbackIndicationManager getInstanceFor(XMPPConnection connection)
-
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.NoResponseException
Determine, 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
public static MessageBuilder addFallbackIndication(MessageBuilder messageBuilder)
Add aFallbackIndicationElement
to the provided message builder.- Parameters:
messageBuilder
- message builder- Returns:
- message builder with added fallback element
-
addFallbackIndicationListener
public void addFallbackIndicationListener(FallbackIndicationListener listener)
Register aFallbackIndicationListener
that gets notified whenever a message that contains aFallbackIndicationElement
is received.- Parameters:
listener
- listener to be registered.
-
removeFallbackIndicationListener
public void removeFallbackIndicationListener(FallbackIndicationListener listener)
Unregister aFallbackIndicationListener
.- Parameters:
listener
- listener to be unregistered.
-
-