From c5ab2829d425ab9f5e7107e9a1e9774ad3e935f2 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 1 Jun 2007 21:42:38 +0000 Subject: [PATCH] Doc fixes (SMACK-277) git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@8428 b35dd754-fafc-0310-a699-88a17e54d16e --- documentation/gettingstarted.html | 4 ++-- documentation/messaging.html | 22 ++++++++++++++-------- documentation/roster.html | 30 ++++++++++++++---------------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/documentation/gettingstarted.html b/documentation/gettingstarted.html index f9e2c2963..6e29bf08c 100644 --- a/documentation/gettingstarted.html +++ b/documentation/gettingstarted.html @@ -96,7 +96,7 @@ and "out fishing":

 // Create a new presence. Pass in false to indicate we're unavailable.
-Presence presence = new Presence(Presence.Type.UNAVAILABLE);
+Presence presence = new Presence(Presence.Type.unavailable);
 presence.setStatus("Gone fishing");
 // Send the packet (assume we have a XMPPConnection instance called "con").
 con.sendPacket(presence);
@@ -115,7 +115,7 @@ XMPPConnection instance.
 
 
 

diff --git a/documentation/messaging.html b/documentation/messaging.html index bb98ab344..ddc2063a9 100644 --- a/documentation/messaging.html +++ b/documentation/messaging.html @@ -29,15 +29,21 @@ A chat creates a new thread of messages (using a thread ID) between two users. T following code snippet demonstrates how to create a new Chat with a user and then send them a text message:

-

// Assume we've created an XMPPConnection name "connection". 
-ChatManager chatmanager = connection.getChatManager();
Chat newChat = chatmanager.createChat(
// Assume we've created an XMPPConnection name "connection".
+ChatManager chatmanager = connection.getChatManager();
+Chat newChat = chatmanager.createChat("jsmith@jivesoftware.com", new MessageListener() {
-
     public void processMessage(Chat chat, Message message) {
-        System.out.println("Received message: " + message); 
-    } 
-}); 
try { - chat.sendMessage("Howdy!");
} catch (XMPPException e) {
System.out.println("Error Delivering block");
}

+ System.out.println("Received message: " + message); + } +}); + +try { + newChat.sendMessage("Howdy!"); +} +catch (XMPPException e) { + System.out.println("Error Delivering block"); +}

@@ -51,7 +57,7 @@ ChatManager chatmanager = connection.getChatManager();
Chat newChat = chatman

-Message newMessage = newChat.createMessage();
+Message newMessage = new Message();
 newMessage.setBody("Howdy!");
 message.setProperty("favoriteColor", "red");
 newChat.sendMessage(newMessage);
diff --git a/documentation/roster.html b/documentation/roster.html
index 025c84b54..bd27a0a0d 100644
--- a/documentation/roster.html
+++ b/documentation/roster.html
@@ -37,9 +37,10 @@ Every user in a roster is represented by a RosterEntry, which consists of:
    The following code snippet prints all entries in the roster:
    -Roster roster = con.getRoster();
    -for (Iterator i=roster.getEntries(); i.hasNext(); ) {
    -    System.out.println(i.next());
    +Roster roster = connection.getRoster();
    +Collection<RosterEntry> entries = roster.getEntries();
    +for (RosterEntry entry : entries) {
    +    System.out.println(entry);
     }
     
    @@ -77,19 +78,16 @@ similar code to update the roster UI with the changing information.
    -final Roster roster = con.getRoster();
    +Roster roster = con.getRoster();
     roster.addRosterListener(new RosterListener() {
    -    public void rosterModified() {
    -        // Ignore event for this example.
    -    }
    -
    -    public void presenceChanged(String user) {
    -        // If the presence is unavailable then "null" will be printed,
    -        // which is fine for this example.
    -        System.out.println("Presence changed: " + roster.getPresence(user));
    +    // Ignored events public void entriesAdded(Collection<String> addresses) {}
    +    public void entriesDeleted(Collection<String> addresses) {}
    +    public void entriesUpdated(Collection<String> addresses) {}
    +    public void presenceChanged(Presence presence) {
    +        System.out.println("Presence changed: " + presence.getFrom() + " " + presence);
         }
     });
    -
    +

Adding Entries to the Roster

@@ -108,17 +106,17 @@ in one of three ways:
  • Process presence subscription requests manually.
-The mode can be set using the Roster.setSubscriptionMode(int subscriptionMode) +The mode can be set using the Roster.setSubscriptionMode(Roster.SubscriptionMode) method. Simple clients normally use one of the automated subscription modes, while full-featured clients should manually process subscription requests and let the end-user accept or reject each request. If using the manual mode, a PacketListener should be registered that listens for Presence packets that have a type of -Presence.Type.SUBSCRIBE. +Presence.Type.subscribe.