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