From ef8d1f794d8616a81210a38879cd4e50517b6aef Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Sat, 18 Oct 2003 21:05:23 +0000 Subject: [PATCH] Added disco support git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2150 b35dd754-fafc-0310-a699-88a17e54d16e --- documentation/extensions/intro.html | 5 +++ documentation/extensions/toc.html | 1 + documentation/extensions/xhtml.html | 47 +++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/documentation/extensions/intro.html b/documentation/extensions/intro.html index e1a782498..195307891 100644 --- a/documentation/extensions/intro.html +++ b/documentation/extensions/intro.html @@ -50,6 +50,11 @@ N/A Send invitations to other users to join a group chat room. + + Service Discovery + JEP-30 + Allows to discover services in XMPP entities. + \ No newline at end of file diff --git a/documentation/extensions/toc.html b/documentation/extensions/toc.html index 67c4d6f9e..9a8ac2da3 100644 --- a/documentation/extensions/toc.html +++ b/documentation/extensions/toc.html @@ -17,6 +17,7 @@ Roster Item Exchange
Time Exchange
Group Chat Invitations
+Service Discovery

diff --git a/documentation/extensions/xhtml.html b/documentation/extensions/xhtml.html index 5efdc1c95..f283f57ba 100644 --- a/documentation/extensions/xhtml.html +++ b/documentation/extensions/xhtml.html @@ -8,13 +8,15 @@
XHTML Messages

-Provdides the ability to send and receive formatted messages using XHTML. +Provides the ability to send and receive formatted messages using XHTML. -

Follow these links to learn how to compose, send and receive XHTML messages:

+

Follow these links to learn how to compose, send, receive and discover support for +XHTML messages:

JEP related: JEP-71 @@ -152,6 +154,47 @@ In this example we can see how to create a PacketListener that obtains the XHTML + +
+ +
Discover support for XHTML Messages

+ +Description

+ +Before you start to send XHTML messages to a user you should discover if the user supports XHTML messages. +There are two ways to achieve the discovery, explicitly and implicitly. Explicit is when you first try +to discover if the user supports XHTML before sending any XHTML message. Implicit is when you send +XHTML messages without first discovering if the conversation partner's client supports XHTML and depenging on +the answer (normal message or XHTML message) you find out if the user supports XHTML messages or not. This +section explains how to explicitly discover for XHTML support.

+ +Usage

+ +In order to discover if a remote user supports XHTML messages send #isServiceEnabled(XMPPConnection +connection, String userID) to the class XHTMLManager where connection is the connection +to use to perform the service discovery and userID is the user to check (A fully qualified xmpp ID, +e.g. jdoe@example.com). This message will return true if the specified user handles XHTML messages.

+ +Example

+ +In this example we can see how to discover if a remote user supports XHTML Messages. +

+
      Message msg = chat.createMessage();
+      // Include a normal body in the message
+      msg.setBody(getTextToSend());
+      // Check if the other user supports XHTML messages
+      if (XHTMLManager.isServiceEnabled(connection, chat.getParticipant())) {
+          // Obtain the XHTML text to send from somewhere
+          String xhtmlBody = getXHTMLTextToSend();
+
+          // Include an XHTML body in the message
+          XHTMLManager.addBody(msg, xhtmlBody);
+      }
+
+      // Send the message
+      chat.sendMessage(msg);
+
+