Class XHTMLManager

  • public class XHTMLManager
    extends Object
    Manages XHTML formatted texts within messages. A XHTMLManager provides a high level access to get and set XHTML bodies to messages, enable and disable XHTML support and check if remote XMPP clients support XHTML.
    • Method Detail

      • getBodies

        public static List<CharSequencegetBodies​(MessageView message)
        Returns an Iterator for the XHTML bodies in the message. Returns null if the message does not contain an XHTML extension.
        message - an XHTML message
        an Iterator for the bodies in the message or null if none.
      • addBody

        public static void addBody​(MessageBuilder messageBuilder,
                                   XHTMLText xhtmlText)
        Adds an XHTML body to the message.
        messageBuilder - the message that will receive the XHTML body
        xhtmlText - the string to add as an XHTML body to the message
      • isXHTMLMessage

        public static boolean isXHTMLMessage​(Message message)
        Returns true if the message contains an XHTML extension.
        message - the message to check if contains an XHTML extension or not
        a boolean indicating whether the message is an XHTML message
      • setServiceEnabled

        public static void setServiceEnabled​(XMPPConnection connection,
                                             boolean enabled)
        Enables or disables the XHTML support on a given connection.

        Before starting to send XHTML messages to a user, check that the user can handle XHTML messages. Enable the XHTML support to indicate that this client handles XHTML messages.

        connection - the connection where the service will be enabled or disabled
        enabled - indicates if the service will be enabled or disabled
      • isServiceEnabled

        public static boolean isServiceEnabled​(XMPPConnection connection)
        Returns true if the XHTML support is enabled for the given connection.
        connection - the connection to look for XHTML support
        a boolean indicating if the XHTML support is enabled for the given connection