mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Comment fixes.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1895 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
9be420c9bc
commit
db806f8a6d
4 changed files with 52 additions and 50 deletions
|
@ -68,7 +68,7 @@ import java.security.cert.CertificateNotYetValidException;
|
|||
|
||||
|
||||
/**
|
||||
* Creates an SSL connection to a XMPP (Jabber) server.
|
||||
* Creates an SSL connection to a XMPP server.
|
||||
*
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
|
|
|
@ -61,7 +61,7 @@ import java.io.*;
|
|||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Creates a connection to a XMPP (Jabber) server. A simple use of this API might
|
||||
* Creates a connection to a XMPP server. A simple use of this API might
|
||||
* look like the following:
|
||||
* <pre>
|
||||
* // Create a connection to the jivesoftware.com XMPP server.
|
||||
|
@ -122,10 +122,10 @@ public class XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new connection to the specified Jabber server. The default port of 5222 will
|
||||
* Creates a new connection to the specified XMPP server. The default port of 5222 will
|
||||
* be used.
|
||||
*
|
||||
* @param host the name of the jabber server to connect to; e.g. <tt>jivesoftware.com</tt>.
|
||||
* @param host the name of the XMPP server to connect to; e.g. <tt>jivesoftware.com</tt>.
|
||||
* @throws XMPPException if an error occurs while trying to establish a connection.
|
||||
*/
|
||||
public XMPPConnection(String host) throws XMPPException {
|
||||
|
@ -133,9 +133,9 @@ public class XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new connection to the to the specified Jabber server on the given port.
|
||||
* Creates a new connection to the to the specified XMPP server on the given port.
|
||||
*
|
||||
* @param host the name of the jabber server to connect to; e.g. <tt>jivesoftware.com</tt>.
|
||||
* @param host the name of the XMPP server to connect to; e.g. <tt>jivesoftware.com</tt>.
|
||||
* @param port the port on the server that should be used; e.g. <tt>5222</tt>.
|
||||
* @throws XMPPException if an error occurs while trying to establish a connection.
|
||||
*/
|
||||
|
@ -156,19 +156,19 @@ public class XMPPConnection {
|
|||
|
||||
/**
|
||||
* Returns the connection ID for this connection, which is the value set by the server
|
||||
* when opening a Jabber stream. If the server does not set a connection ID, this value
|
||||
* when opening a XMPP stream. If the server does not set a connection ID, this value
|
||||
* will be null.
|
||||
*
|
||||
* @return the ID of this connection returned from the Jabber server.
|
||||
* @return the ID of this connection returned from the XMPP server.
|
||||
*/
|
||||
public String getConnectionID() {
|
||||
return connectionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the host name of the Jabber server for this connection.
|
||||
* Returns the host name of the XMPP server for this connection.
|
||||
*
|
||||
* @return the host name of the Jabber server.
|
||||
* @return the host name of the XMPP server.
|
||||
*/
|
||||
public String getHost() {
|
||||
return host;
|
||||
|
@ -178,7 +178,7 @@ public class XMPPConnection {
|
|||
* Returns the port number of the XMPP server for this connection. The default port
|
||||
* for normal connections is 5222. The default port for SSL connections is 5223.
|
||||
*
|
||||
* @return the port number of the Jabber server.
|
||||
* @return the port number of the XMPP server.
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
|
@ -364,7 +364,7 @@ public class XMPPConnection {
|
|||
|
||||
/**
|
||||
* Creates a new chat with the specified participant. The participant should
|
||||
* be a valid Jabber user such as <tt>jdoe@jivesoftware.com</tt> or
|
||||
* be a valid XMPP user such as <tt>jdoe@jivesoftware.com</tt> or
|
||||
* <tt>jdoe@jivesoftware.com/work</tt>.
|
||||
*
|
||||
* @param participant the person to start the conversation with.
|
||||
|
@ -479,7 +479,7 @@ public class XMPPConnection {
|
|||
|
||||
/**
|
||||
* Initializes the connection by creating a packet reader and writer and opening a
|
||||
* Jabber stream to the server.
|
||||
* XMPP stream to the server.
|
||||
*
|
||||
* @throws XMPPException if establishing a connection to the server fails.
|
||||
*/
|
||||
|
@ -508,7 +508,7 @@ public class XMPPConnection {
|
|||
if (DEBUG_ENABLED) {
|
||||
packetReader.addPacketListener(debugListener, null);
|
||||
}
|
||||
// Start the packet writer. This will open a Jabber stream to the server
|
||||
// Start the packet writer. This will open a XMPP stream to the server
|
||||
packetWriter.startup();
|
||||
// Start the packet reader. The startup() method will block until we
|
||||
// get an opening stream packet back from server.
|
||||
|
|
|
@ -136,7 +136,7 @@ public class Presence extends Packet {
|
|||
|
||||
/**
|
||||
* Returns the status message of the presence update, or <tt>null</tt> if there
|
||||
* is not status. The status is free-form text describing a user's presence
|
||||
* is not a status. The status is free-form text describing a user's presence
|
||||
* (i.e., "gone to lunch").
|
||||
*
|
||||
* @return the status message.
|
||||
|
@ -147,7 +147,7 @@ public class Presence extends Packet {
|
|||
|
||||
/**
|
||||
* Sets the status message of the presence update. The status is free-form text
|
||||
* describing a user's presence (i.e., gone to lunch).
|
||||
* describing a user's presence (i.e., "gone to lunch").
|
||||
*
|
||||
* @param status the status message.
|
||||
*/
|
||||
|
@ -175,6 +175,7 @@ public class Presence extends Packet {
|
|||
|
||||
/**
|
||||
* Returns the mode of the presence update, or <tt>null</tt> if no mode has been set.
|
||||
* A <tt>null</tt> value for mode means the client is in the standard "available" state.
|
||||
*
|
||||
* @return the mode.
|
||||
*/
|
||||
|
@ -183,7 +184,8 @@ public class Presence extends Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the mode of the presence update.
|
||||
* Sets the mode of the presence update. For the standard "available" state, set
|
||||
* the mode to <tt>null</tt>.
|
||||
*
|
||||
* @param mode the mode.
|
||||
*/
|
||||
|
|
|
@ -68,71 +68,71 @@ public class StringUtils {
|
|||
private static final char[] GT_ENCODE = ">".toCharArray();
|
||||
|
||||
/**
|
||||
* Returns the name portion of a Jabber ID (JID). For example, for the
|
||||
* JID "matt@jivesoftware.com/Smack", "matt" would be returned. If no
|
||||
* username is present in the JID, the empty string will be returned.
|
||||
* Returns the name portion of a XMPP ID. For example, for the
|
||||
* ID "matt@jivesoftware.com/Smack", "matt" would be returned. If no
|
||||
* username is present in the ID, the empty string will be returned.
|
||||
*
|
||||
* @param JID the Jabber ID.
|
||||
* @return the name portion of the JID.
|
||||
* @param ID the XMPP ID.
|
||||
* @return the name portion of the XMPP ID.
|
||||
*/
|
||||
public static String parseName(String JID) {
|
||||
if (JID == null) {
|
||||
public static String parseName(String ID) {
|
||||
if (ID == null) {
|
||||
return null;
|
||||
}
|
||||
int atIndex = JID.indexOf("@");
|
||||
int atIndex = ID.indexOf("@");
|
||||
if (atIndex < 0) {
|
||||
return JID.substring(0);
|
||||
return ID.substring(0);
|
||||
}
|
||||
else {
|
||||
return JID.substring(0, atIndex);
|
||||
return ID.substring(0, atIndex);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name portion of a Jabber ID (JID). For example, for the
|
||||
* JID "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned.
|
||||
* If no server is present in the JID, the empty string will be returned.
|
||||
* Returns the name portion of a XMPP ID. For example, for the
|
||||
* ID "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned.
|
||||
* If no server is present in the ID, the empty string will be returned.
|
||||
*
|
||||
* @param JID the Jabber ID.
|
||||
* @return the resource portion of the JID.
|
||||
* @param ID the XMPP ID.
|
||||
* @return the resource portion of the XMPP ID.
|
||||
*/
|
||||
public static String parseServer(String JID) {
|
||||
if (JID == null) {
|
||||
public static String parseServer(String ID) {
|
||||
if (ID == null) {
|
||||
return null;
|
||||
}
|
||||
int atIndex = JID.indexOf("@");
|
||||
int atIndex = ID.indexOf("@");
|
||||
// If the String ends with '@', return the empty string.
|
||||
if (atIndex + 1 > JID.length() || atIndex < 0) {
|
||||
if (atIndex + 1 > ID.length() || atIndex < 0) {
|
||||
return "";
|
||||
}
|
||||
int slashIndex = JID.indexOf("/");
|
||||
int slashIndex = ID.indexOf("/");
|
||||
if (slashIndex > 0) {
|
||||
return JID.substring(atIndex + 1, slashIndex);
|
||||
return ID.substring(atIndex + 1, slashIndex);
|
||||
}
|
||||
else {
|
||||
return JID.substring(atIndex + 1);
|
||||
return ID.substring(atIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name portion of a Jabber ID (JID). For example, for the
|
||||
* JID "matt@jivesoftware.com/Smack", "Smack" would be returned. If no
|
||||
* resource is present in the JID, the empty string will be returned.
|
||||
* Returns the name portion of a XMPP ID. For example, for the
|
||||
* ID "matt@jivesoftware.com/Smack", "Smack" would be returned. If no
|
||||
* resource is present in the ID, the empty string will be returned.
|
||||
*
|
||||
* @param JID the Jabber ID.
|
||||
* @return the resource portion of the JID.
|
||||
* @param ID the XMPP ID.
|
||||
* @return the resource portion of the XMPP ID.
|
||||
*/
|
||||
public static String parseResource(String JID) {
|
||||
if (JID == null) {
|
||||
public static String parseResource(String ID) {
|
||||
if (ID == null) {
|
||||
return null;
|
||||
}
|
||||
int slashIndex = JID.indexOf("/");
|
||||
if (slashIndex + 1 > JID.length() || slashIndex < 0) {
|
||||
int slashIndex = ID.indexOf("/");
|
||||
if (slashIndex + 1 > ID.length() || slashIndex < 0) {
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
return JID.substring(slashIndex + 1);
|
||||
return ID.substring(slashIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue