Package org.jivesoftware.smackx.xhtmlim
Class XHTMLManager
- java.lang.Object
-
- org.jivesoftware.smackx.xhtmlim.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.
-
-
Constructor Summary
Constructors Constructor Description XHTMLManager()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
addBody(MessageBuilder messageBuilder, XHTMLText xhtmlText)
Adds an XHTML body to the message.static void
addBody(Message message, XHTMLText xhtmlText)
Deprecated.useaddBody(MessageBuilder, XHTMLText)
instead.static List<CharSequence>
getBodies(MessageView message)
Returns an Iterator for the XHTML bodies in the message.static boolean
isServiceEnabled(XMPPConnection connection)
Returns true if the XHTML support is enabled for the given connection.static boolean
isServiceEnabled(XMPPConnection connection, Jid userID)
Returns true if the specified user handles XHTML messages.static boolean
isXHTMLMessage(Message message)
Returns true if the message contains an XHTML extension.static void
setServiceEnabled(XMPPConnection connection, boolean enabled)
Enables or disables the XHTML support on a given connection.
-
-
-
Constructor Detail
-
XHTMLManager
public XHTMLManager()
-
-
Method Detail
-
getBodies
public static List<CharSequence> getBodies(MessageView message)
Returns an Iterator for the XHTML bodies in the message. Returns null if the message does not contain an XHTML extension.- Parameters:
message
- an XHTML message- Returns:
- 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.- Parameters:
messageBuilder
- the message that will receive the XHTML bodyxhtmlText
- the string to add as an XHTML body to the message
-
addBody
@Deprecated public static void addBody(Message message, XHTMLText xhtmlText)
Deprecated.useaddBody(MessageBuilder, XHTMLText)
instead.Adds an XHTML body to the message.- Parameters:
message
- the message that will receive the XHTML bodyxhtmlText
- 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.- Parameters:
message
- the message to check if contains an XHTML extension or not- Returns:
- 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.
- Parameters:
connection
- the connection where the service will be enabled or disabledenabled
- 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.- Parameters:
connection
- the connection to look for XHTML support- Returns:
- a boolean indicating if the XHTML support is enabled for the given connection
-
isServiceEnabled
public static boolean isServiceEnabled(XMPPConnection connection, Jid userID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
Returns true if the specified user handles XHTML messages.- Parameters:
connection
- the connection to use to perform the service discoveryuserID
- the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com- Returns:
- a boolean indicating whether the specified user handles XHTML messages
- Throws:
XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NoResponseException
- if there was no response from the remote entity.SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
-