Class FallbackIndicationManager

java.lang.Object
org.jivesoftware.smack.Manager
org.jivesoftware.smackx.fallback_indication.FallbackIndicationManager

public final class FallbackIndicationManager extends org.jivesoftware.smack.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:
  • Method Details

    • getInstanceFor

      public static FallbackIndicationManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
    • userSupportsFallbackIndications

      public boolean userSupportsFallbackIndications(org.jxmpp.jid.EntityBareJid jid) throws org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException
      Determine, whether or not a user supports Fallback Indications.
      Parameters:
      jid - BareJid of the user.
      Returns:
      feature support
      Throws:
      org.jivesoftware.smack.XMPPException.XMPPErrorException - if a protocol level error happens
      org.jivesoftware.smack.SmackException.NotConnectedException - if the connection is not connected
      InterruptedException - if the thread is being interrupted
      org.jivesoftware.smack.SmackException.NoResponseException - if the server doesn't send a response in time
    • serverSupportsFallbackIndications

      public boolean serverSupportsFallbackIndications() throws org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException
      Determine, whether or not the server supports Fallback Indications.
      Returns:
      server side feature support
      Throws:
      org.jivesoftware.smack.XMPPException.XMPPErrorException - if a protocol level error happens
      org.jivesoftware.smack.SmackException.NotConnectedException - if the connection is not connected
      InterruptedException - if the thread is being interrupted
      org.jivesoftware.smack.SmackException.NoResponseException - if the server doesn't send a response in time
    • addFallbackIndicationWithBody

      public static org.jivesoftware.smack.packet.MessageBuilder addFallbackIndicationWithBody(org.jivesoftware.smack.packet.MessageBuilder messageBuilder, String fallbackMessageBody)
      Set the body of the message to the provided fallback message and add a FallbackIndicationElement.
      Parameters:
      messageBuilder - message builder
      fallbackMessageBody - fallback message body
      Returns:
      builder with set body and added fallback element
    • addFallbackIndication

      public static org.jivesoftware.smack.packet.MessageBuilder addFallbackIndication(org.jivesoftware.smack.packet.MessageBuilder messageBuilder)
      Add a FallbackIndicationElement to the provided message builder.
      Parameters:
      messageBuilder - message builder
      Returns:
      message builder with added fallback element
    • addFallbackIndicationListener

      public void addFallbackIndicationListener(FallbackIndicationListener listener)
      Register a FallbackIndicationListener that gets notified whenever a message that contains a FallbackIndicationElement is received.
      Parameters:
      listener - listener to be registered.
    • removeFallbackIndicationListener

      public void removeFallbackIndicationListener(FallbackIndicationListener listener)
      Parameters:
      listener - listener to be unregistered.