mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 10:49:41 +02:00
Doc fixes (SMACK-277)
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@8428 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
41b4308936
commit
c5ab2829d4
3 changed files with 30 additions and 26 deletions
|
@ -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:<p>
|
||||
|
||||
<div class="code"><pre><font color="gray"><i>// Assume we've created an XMPPConnection name "connection".</i></font>
|
||||
ChatManager chatmanager = connection.getChatManager();<br>Chat newChat = chatmanager.createChat(<font
|
||||
<div class="code"><pre><font color="gray"><i>// Assume we've created an XMPPConnection name "connection".</i></font>
|
||||
ChatManager chatmanager = connection.getChatManager();
|
||||
Chat newChat = chatmanager.createChat(<font
|
||||
color="green">"jsmith@jivesoftware.com"</font>, new MessageListener() {
|
||||
|
||||
public void processMessage(Chat chat, Message message) {
|
||||
System.out.println(<font color="green">"Received message: "</font> + message);
|
||||
}
|
||||
}); <br>try {
|
||||
chat.sendMessage(<font color="green">"Howdy!"</font>); <br>} catch (XMPPException e) {<br> System.out.println("Error Delivering block");<br>}<br><br>
|
||||
System.out.println(<font color="green">"Received message: "</font> + message);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
newChat.sendMessage(<font color="green">"Howdy!"</font>);
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
System.out.println(<font color="green">"Error Delivering block"</font>);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<p>
|
||||
|
@ -51,7 +57,7 @@ ChatManager chatmanager = connection.getChatManager();<br>Chat newChat = chatman
|
|||
<p>
|
||||
|
||||
<div class="code"><pre>
|
||||
Message newMessage = newChat.createMessage();
|
||||
Message newMessage = new Message();
|
||||
newMessage.setBody(<font color="green">"Howdy!"</font>);
|
||||
message.setProperty(<font color="green">"favoriteColor"</font>, <font color="green">"red"</font>);
|
||||
newChat.sendMessage(newMessage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue