1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 02:39:42 +02:00

Renamed Connection to XMPPConnection

This commit is contained in:
Florian Schmaus 2014-03-10 09:45:50 +01:00
parent f3e007bad5
commit 489816c61f
145 changed files with 639 additions and 641 deletions

View file

@ -1,13 +1,13 @@
<html>
<head>
<title>Smack: Connection Management - Jive Software</title>
<title>Smack: XMPPConnection Management - Jive Software</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div class="header">
Smack: Connection Management
Smack: XMPPConnection Management
</div>
<div class="nav">
@ -19,7 +19,7 @@
</p>
<p>
The <tt>org.jivesoftware.smack.Connection</tt> class manages your connection to an XMPP
The <tt>org.jivesoftware.smack.XMPPConnection</tt> class manages your connection to an XMPP
server. The default implementation is the <tt>org.jivesoftware.smack.XMPPConnection</tt>
class. Two constructors are mainly used. The first, <tt>XMPPConnection(String)</tt> takes
the server name you'd like to connect to as an argument. All default connection settings will
@ -80,7 +80,7 @@ manager will try to immediately reconnect to the server and increase the delay b
successive reconnections keep failing.</i>
<br>
In case you want to force a reconnection while the reconnetion manager is waiting for the next
reconnection, you can just use <i>Connection#connect()</i> and a new attempt will be made.
reconnection, you can just use <i>XMPPConnection#connect()</i> and a new attempt will be made.
If the manual attempt also failed then the reconnection manager will still continue the
reconnection job.
</p>

View file

@ -26,7 +26,7 @@ Debugging mode can be enabled in two different ways:
<ol>
<li>Add the following line of code <b>before</b> creating new connections:<p>
<tt>Connection.DEBUG_ENABLED = true;</tt><p>
<tt>XMPPConnection.DEBUG_ENABLED = true;</tt><p>
<li>Set the Java system property <tt>smack.debugEnabled</tt> to true. The
system property can be set on the command line such as:<p>
@ -39,7 +39,7 @@ add the following line to your application before opening new connections:
</p>
<p>
<tt>Connection.DEBUG_ENABLED = false;</tt>
<tt>XMPPConnection.DEBUG_ENABLED = false;</tt>
</p>
<p>
@ -73,7 +73,7 @@ When debugging mode is enabled, a debug window will appear containing tabs for e
The window will contain the following information:
<ul>
<li>Connection tabs -- each tab shows debugging information related to the connection.
<li>XMPPConnection tabs -- each tab shows debugging information related to the connection.
<li>Smack info tab -- shows information about Smack (e.g. Smack version, installed components, etc.).
</ul>

View file

@ -34,9 +34,9 @@ discovery request with the information that you previously configured.</p>
<b>Usage</b><p>
In order to configure the supported features by your client you should first obtain the
ServiceDiscoveryManager associated with your Connection. To get your ServiceDiscoveryManager
ServiceDiscoveryManager associated with your XMPPConnection. To get your ServiceDiscoveryManager
send <b>getInstanceFor(connection)</b> to the class <i><b>ServiceDiscoveryManager</b></i> where
connection is your Connection.<br></p>
connection is your XMPPConnection.<br></p>
<p>Once you have your ServiceDiscoveryManager you will be able to manage the supported features. To
register a new feature send <b>addFeature(feature)</b> to your <i><b>ServiceDiscoveryManager</b></i>
@ -48,7 +48,7 @@ String that represents the feature to remove.</p>
In this example we can see how to add and remove supported features: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Register that a new feature is supported by this XMPP entity</font>
@ -74,7 +74,7 @@ to configure the information providers associated to the items/nodes within the
In order to configure the associated nodes within the Smack client you will need to create a
NodeInformationProvider and register it with the <i><b>ServiceDiscoveryManager</b></i>. To get
your ServiceDiscoveryManager send <b>getInstanceFor(connection)</b> to the class <i><b>ServiceDiscoveryManager</b></i>
where connection is your Connection.<br></p>
where connection is your XMPPConnection.<br></p>
<p>Once you have your ServiceDiscoveryManager you will be able to register information providers
for the XMPP entity's nodes. To register a new node information provider send <b>setNodeInformationProvider(String node, NodeInformationProvider listener)</b>
@ -126,7 +126,7 @@ the discovered items.</p>
In this example we can see how to discover the items associated with an online catalog service: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Get the items of a given XMPP entity</font>
@ -171,7 +171,7 @@ the discovered information.</p>
In this example we can see how to discover the information of a conference room: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Get the information of a given XMPP entity</font>
@ -216,7 +216,7 @@ to publish.</p>
In this example we can see how to publish new items: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my Connection</font>
<pre> <font color="#3f7f5f">// Obtain the ServiceDiscoveryManager associated with my XMPPConnection</font>
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
<font color="#3f7f5f">// Create a DiscoverItems with the items to publish</font>

View file

@ -34,7 +34,7 @@ to enable the user to easily send a file.
<b>Usage</b><p>
In order to send a file you must first construct an instance of the <b><i>FileTransferManager</i></b>
class. This class has one constructor with one parameter which is your Connection.
class. This class has one constructor with one parameter which is your XMPPConnection.
In order to instantiate the manager you should call <i>new FileTransferManager(connection)</i>
<p>Once you have your <b><i>FileTransferManager</i></b> you will need to create an outgoing
@ -86,7 +86,7 @@ manager.</p>
<b>Usage</b><p>
In order to recieve a file you must first construct an instance of the <b><i>FileTransferManager</i></b>
class. This class has one constructor with one parameter which is your Connection.
class. This class has one constructor with one parameter which is your XMPPConnection.
In order to instantiate the manager you should call <i>new FileTransferManager(connection)</i>
<p>Once you have your <b><i>FileTransferManager</i></b> you will need to register a listener

View file

@ -75,14 +75,14 @@ You can receive notification requests for the following events: delivered, displ
The general idea is to create a new <i>DefaultMessageEventRequestListener</i> that will listen to the event notifications
requests and react with custom logic. Then you will have to add the listener to the
<i>MessageEventManager</i> that works on
the desired <i>Connection</i>.
the desired <i>XMPPConnection</i>.
<p>Note that <i>DefaultMessageEventRequestListener</i> is a default implementation of the
<i>MessageEventRequestListener</i> interface.
The class <i>DefaultMessageEventRequestListener</i> automatically sends a delivered notification to the sender of the message
if the sender has requested to be notified when the message is delivered. If you decide to create a new class that
implements the <i>MessageEventRequestListener</i> interface, please remember to send the delivered notification.</p>
<ul>
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(Connection)</b></i> constructor.
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(XMPPConnection)</b></i> constructor.
</li>
<li>To create an event notification requests listener create a subclass of <i><b>DefaultMessageEventRequestListener</b></i> or
create a class that implements the <i><b>MessageEventRequestListener</b></i> interface.
@ -178,9 +178,9 @@ will probably want to react to some or all of these events.</p>
The general idea is to create a new <i>MessageEventNotificationListener</i> that will listen to the event notifications
and react with custom logic. Then you will have to add the listener to the <i>MessageEventManager</i> that works on
the desired <i>Connection</i>.
the desired <i>XMPPConnection</i>.
<ul>
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(Connection)</b></i> constructor.
<li>To create a new <i>MessageEventManager</i> use the <i><b>MessageEventManager(XMPPConnection)</b></i> constructor.
</li>
<li>To create an event notifications listener create a class that implements the <i><b>MessageEventNotificationListener</b></i>
interface.

View file

@ -51,7 +51,7 @@ the form and finally send it back to the server.</p>
In this example we can see how to create an instant room: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// Create the room</font>
@ -65,7 +65,7 @@ In this example we can see how to create an instant room: <br>
In this example we can see how to create a reserved room. The form is completed with default values: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// Create the room</font>
@ -121,7 +121,7 @@ for a response from the server.</p>
In this example we can see how to join a room with a given nickname: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc2 = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// User2 joins the new room</font>
@ -132,7 +132,7 @@ In this example we can see how to join a room with a given nickname: <br>
In this example we can see how to join a room with a given nickname and password: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc2 = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// User2 joins the new room using a password</font>
@ -144,7 +144,7 @@ In this example we can see how to join a room with a given nickname and password
In this example we can see how to join a room with a given nickname specifying the amount of history
to receive: <br>
<blockquote>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a Connection for a room</font>
<pre> <font color="#3f7f5f">// Create a MultiUserChat using a XMPPConnection for a room</font>
MultiUserChat muc2 = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
<font color="#3f7f5f">// User2 joins the new room using a password and specifying</font>
@ -205,7 +205,7 @@ In this example we can see how to listen for room invitations and decline invita
<blockquote>
<pre> <font color="#3f7f5f">// User3 listens for MUC invitations</font>
MultiUserChat.addInvitationListener(conn3, new InvitationListener() {
public void invitationReceived(Connection conn, String room, String inviter, String reason, String password) {
public void invitationReceived(XMPPConnection conn, String room, String inviter, String reason, String password) {
<font color="#3f7f5f">// Reject the invitation</font>
MultiUserChat.decline(conn, room, inviter, <font color="#0000FF">"I'm busy right now"</font>);
}
@ -224,7 +224,7 @@ A user may want to discover if one of the user's contacts supports the Multi-Use
<b>Usage</b><p>
In order to discover if one of the user's contacts supports MUC just send
<b>isServiceEnabled(Connection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
<b>isServiceEnabled(XMPPConnection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
class where user is a fully qualified XMPP ID, e.g. jdoe@example.com. You will receive
a boolean indicating whether the user supports MUC or not.</p>
@ -248,7 +248,7 @@ A user may also want to query a contact regarding which rooms the contact is in.
<b>Usage</b><p>
In order to get the rooms where a user is in just send
<b>getJoinedRooms(Connection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
<b>getJoinedRooms(XMPPConnection connection, String user)</b> to the <i><b>MultiUserChat</b></i>
class where user is a fully qualified XMPP ID, e.g. jdoe@example.com. You will get an Iterator
of Strings as an answer where each String represents a room name.</p>
@ -272,7 +272,7 @@ will provide information only for public rooms.</p>
<b>Usage</b><p>
In order to discover information about a room just send <b>getRoomInfo(Connection connection, String room)</b>
In order to discover information about a room just send <b>getRoomInfo(XMPPConnection connection, String room)</b>
to the <i><b>MultiUserChat</b></i> class where room is the XMPP ID of the room, e.g.
roomName@conference.myserver. You will get a RoomInfo object that contains the discovered room
information.</p>

View file

@ -47,7 +47,7 @@ a fully configured node.</p><p>
Create an instant node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Create the node</font>
@ -58,7 +58,7 @@ Create an instant node: <br>
Create a node with default configuration and then configure it: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Create the node</font>
@ -77,7 +77,7 @@ Create a node with default configuration and then configure it: <br>
Create and configure a node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Create the node</font>
@ -117,7 +117,7 @@ will be dependent on its configuration.
In this example we publish an item to a node that does not take payload: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -133,7 +133,7 @@ In this example we publish an item to a node that does not take payload: <br>
In this example we publish an item to a node that does take payload: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -174,7 +174,7 @@ In this example we can see how to create a listener and register it and then sub
messages. <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -212,7 +212,7 @@ In this example we can see how to create a listener, register it and then subscr
item deletion messages. <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -250,7 +250,7 @@ In this example we can see how to create a listener, register it and then subscr
node configuration messages. <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -315,7 +315,7 @@ of a <i><b>LeafNode</b></i> and call one of the retrieve methods.
In this example we can see how to retrieve the existing items from a node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -329,7 +329,7 @@ In this example we can see how to retrieve the existing items from a node: <br>
In this example we can see how to retrieve the last N existing items: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -343,7 +343,7 @@ In this example we can see how to retrieve the specified existing items: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the node</font>
@ -375,7 +375,7 @@ or <i><b>Node</b></i> classes depending on what type of information is required.
In this example we can see how to get pubsub capabilities: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the pubsub features that are supported</font>
@ -386,7 +386,7 @@ In this example we can see how to get pubsub capabilities: <br>
In this example we can see how to get pubsub subscriptions for all nodes: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get all the subscriptions in the pubsub service</font>
@ -397,7 +397,7 @@ In this example we can see how to get pubsub subscriptions for all nodes: <br>
In this example we can see how to get all affiliations for the users bare JID on the pubsub service: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
<font color="#3f7f5f">// Get the affiliations for the users bare JID</font>
@ -408,7 +408,7 @@ In this example we can see how to get all affiliations for the users bare JID on
In this example we can see how to get information about the node: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
Node node = mgr.getNode(<font color="#0000FF">"testNode"</font>);
@ -420,7 +420,7 @@ In this example we can see how to get information about the node: <br>
In this example we can see how to discover the node items: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
Node node = mgr.getNode(<font color="#0000FF">"testNode"</font>);
@ -432,7 +432,7 @@ In this example we can see how to discover the node items: <br>
In this example we can see how to get node subscriptions: <br>
<blockquote>
<pre>
<font color="#3f7f5f">// Create a pubsub manager using an existing Connection</font>
<font color="#3f7f5f">// Create a pubsub manager using an existing XMPPConnection</font>
PubSubManager mgr = new PubSubManager(con);
Node node = mgr.getNode(<font color="#0000FF">"testNode"</font>);

View file

@ -126,7 +126,7 @@ received.</p>
<li>Create a class that implements the <i><b>RosterExchangeListener</b></i> interface.</li>
<li>Implement the method <b>entriesReceived(String, Iterator)</b> that will be called when new entries
are received with custom logic.</li>
<li>Add the listener to the <i>RosterExchangeManager</i> that works on the desired <i>Connection</i>.</li>
<li>Add the listener to the <i>RosterExchangeManager</i> that works on the desired <i>XMPPConnection</i>.</li>
</ol></p>
<b>Example</b><p>

View file

@ -97,7 +97,7 @@ the message as you do with any other message.</p>
An XHTML message is like any regular message, therefore to send the message you can follow
the usual steps you do in order to send a message. For example, to send a message as part
of a chat just use the message <b>#send(Message)</b> of <i><b>Chat</b></i> or you can use
the message <b>#send(Packet)</b> of <i><b>Connection</b></i>.</p>
the message <b>#send(Packet)</b> of <i><b>XMPPConnection</b></i>.</p>
<b>Example</b><p>
@ -170,7 +170,7 @@ section explains how to explicitly discover for XHTML support.</p>
<b>Usage</b><p>
In order to discover if a remote user supports XHTML messages send <b>#isServiceEnabled(Connection
In order to discover if a remote user supports XHTML messages send <b>#isServiceEnabled(XMPPConnection
connection, String userID)</b> to the class <i><b>XHTMLManager</b></i> 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.</p>

View file

@ -94,10 +94,10 @@ conn2.connect();
<p>Note that maximum security will be used when connecting to the server by default (and when possible),
including use of TLS encryption. The ConnectionConfiguration class provides advanced control
over the connection created, such as the ability to disable or require encryption. See
<a href="connections.html">Connection Management</a> for full details.</p>
<a href="connections.html">XMPPConnection Management</a> for full details.</p>
<p>Once you've created a connection, you should login using a username and password
with the <tt>Connection.login(String username, String password)</tt> method.
with the <tt>XMPPConnection.login(String username, String password)</tt> method.
Once you've logged in, you can being chatting with other users by creating
new <tt>Chat</tt> or <tt>GroupChat</tt> objects.
@ -108,7 +108,7 @@ The roster lets you keep track of the availability (presence) of other users. Us
can be organized into groups such as "Friends" and "Co-workers", and then you
discover whether each user is online or offline.<p>
Retrieve the roster using the <tt>Connection.getRoster()</tt> method. The roster
Retrieve the roster using the <tt>XMPPConnection.getRoster()</tt> method. The roster
class allows you to find all the roster entries, the groups they belong to, and the
current presence status of each entry.
@ -130,7 +130,7 @@ and "out fishing":<p>
<font color="gray"><i>// Create a new presence. Pass in false to indicate we're unavailable.</i></font>
Presence presence = new Presence(Presence.Type.unavailable);
presence.setStatus(<font color="green">"Gone fishing"</font>);
<font color="gray"><i>// Send the packet (assume we have a Connection instance called "con").</i></font>
<font color="gray"><i>// Send the packet (assume we have a XMPPConnection instance called "con").</i></font>
con.sendPacket(presence);
</pre></div>
<p>

View file

@ -29,7 +29,7 @@ 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 a Connection name "connection".</i></font>
<div class="code"><pre><font color="gray"><i>// Assume we've created a XMPPConnection name "connection".</i></font>
ChatManager chatmanager = connection.getChatManager();
Chat newChat = chatmanager.createChat(<font
color="green">"jsmith@jivesoftware.com"</font>, new MessageListener() {
@ -98,7 +98,7 @@ will create a new one that does match. To get this new chat, you have to regist
notified when it happens. You can register a message listener to receive all future messages as
part of this handler.<p>
<div class="code"><pre><font color="gray"><i>// Assume we've created a Connection name "connection".</i></font>
<div class="code"><pre><font color="gray"><i>// Assume we've created a XMPPConnection name "connection".</i></font>
ChatManager chatmanager = connection.getChatManager().addChatListener(
new ChatManagerListener() {
@Override

View file

@ -27,7 +27,7 @@ A packet listener is used for event style programming, while a packet collector
result queue of packets that you can do polling and blocking operations on. So, a packet
listener is useful when you want to take some action whenever a packet happens to come in,
while a packet collector is useful when you want to wait for a specific packet to
arrive. Packet collectors and listeners can be created using an <tt>Connection</tt> instance.<p>
arrive. Packet collectors and listeners can be created using an <tt>XMPPConnection</tt> instance.<p>
The <tt>org.jivesoftware.smack.filter.PacketFilter</tt> interface determines which
specific packets will be delivered to a <tt>PacketCollector</tt> or <tt>PacketListener</tt>.
@ -42,7 +42,7 @@ listener:<p>
<font color="gray"><i>// user. We use an AndFilter to combine two other filters.</i></font>
PacketFilter filter = new AndFilter(new PacketTypeFilter(<b>Message.class</b>),
new FromContainsFilter(<font color="green">"mary@jivesoftware.com"</font>));
<font color="gray"><i>// Assume we've created a Connection name "connection".</i></font>
<font color="gray"><i>// Assume we've created a XMPPConnection name "connection".</i></font>
<font color="gray"><i>// First, register a packet collector using the filter we created.</i></font>
PacketCollector myCollector = connection.createPacketCollector(filter);

View file

@ -21,7 +21,7 @@ A roster also allows you to organize users into groups such as "Friends" and
"Co-workers". Other IM systems refer to the roster as the buddy list, contact list,
etc.<p>
A <tt>Roster</tt> instance is obtained using the <tt>Connection.getRoster()</tt>
A <tt>Roster</tt> instance is obtained using the <tt>XMPPConnection.getRoster()</tt>
method.
<p class="subheader">Roster Entries</p>