1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 04:57:58 +01:00

Variable name changes.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2022 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-08-12 19:31:54 +00:00 committed by mtucker
parent 1d1a60c00a
commit 848a1d725b

View file

@ -68,71 +68,71 @@ public class StringUtils {
private static final char[] GT_ENCODE = ">".toCharArray();
/**
* 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.
* Returns the name portion of a XMPP address. For example, for the
* address "matt@jivesoftware.com/Smack", "matt" would be returned. If no
* username is present in the address, the empty string will be returned.
*
* @param ID the XMPP ID.
* @return the name portion of the XMPP ID.
* @param XMPPAddress the XMPP address.
* @return the name portion of the XMPP address.
*/
public static String parseName(String ID) {
if (ID == null) {
public static String parseName(String XMPPAddress) {
if (XMPPAddress == null) {
return null;
}
int atIndex = ID.indexOf("@");
int atIndex = XMPPAddress.indexOf("@");
if (atIndex < 0) {
return ID.substring(0);
return XMPPAddress.substring(0);
}
else {
return ID.substring(0, atIndex);
return XMPPAddress.substring(0, atIndex);
}
}
/**
* 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.
* Returns the name portion of a XMPP address. For example, for the
* address "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned.
* If no server is present in the address, the empty string will be returned.
*
* @param ID the XMPP ID.
* @return the resource portion of the XMPP ID.
* @param XMPPAddress the XMPP address.
* @return the resource portion of the XMPP address.
*/
public static String parseServer(String ID) {
if (ID == null) {
public static String parseServer(String XMPPAddress) {
if (XMPPAddress == null) {
return null;
}
int atIndex = ID.indexOf("@");
int atIndex = XMPPAddress.indexOf("@");
// If the String ends with '@', return the empty string.
if (atIndex + 1 > ID.length() || atIndex < 0) {
if (atIndex + 1 > XMPPAddress.length() || atIndex < 0) {
return "";
}
int slashIndex = ID.indexOf("/");
int slashIndex = XMPPAddress.indexOf("/");
if (slashIndex > 0) {
return ID.substring(atIndex + 1, slashIndex);
return XMPPAddress.substring(atIndex + 1, slashIndex);
}
else {
return ID.substring(atIndex + 1);
return XMPPAddress.substring(atIndex + 1);
}
}
/**
* 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.
* Returns the name portion of a XMPP address. For example, for the
* address "matt@jivesoftware.com/Smack", "Smack" would be returned. If no
* resource is present in the address, the empty string will be returned.
*
* @param ID the XMPP ID.
* @return the resource portion of the XMPP ID.
* @param XMPPAddress the XMPP address.
* @return the resource portion of the XMPP address.
*/
public static String parseResource(String ID) {
if (ID == null) {
public static String parseResource(String XMPPAddress) {
if (XMPPAddress == null) {
return null;
}
int slashIndex = ID.indexOf("/");
if (slashIndex + 1 > ID.length() || slashIndex < 0) {
int slashIndex = XMPPAddress.indexOf("/");
if (slashIndex + 1 > XMPPAddress.length() || slashIndex < 0) {
return "";
}
else {
return ID.substring(slashIndex + 1);
return XMPPAddress.substring(slashIndex + 1);
}
}