1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Removed #toLowecase() calls wherever possible. SMACK-109

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3349 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-01-24 18:14:41 +00:00 committed by gato
parent 4964786ec9
commit 18677279f2
4 changed files with 16 additions and 36 deletions

View file

@ -119,10 +119,11 @@ public class RosterGroup {
// Roster entries never include a resource so remove the resource
// if it's a part of the XMPP address.
user = StringUtils.parseBareAddress(user);
String userLowerCase = user.toLowerCase();
synchronized (entries) {
for (Iterator i=entries.iterator(); i.hasNext(); ) {
RosterEntry entry = (RosterEntry)i.next();
if (entry.getUser().toLowerCase().equals(user.toLowerCase())) {
if (entry.getUser().equals(userLowerCase)) {
return entry;
}
}
@ -149,21 +150,7 @@ public class RosterGroup {
* @return true if the XMPP address is an entry in this group.
*/
public boolean contains(String user) {
if (user == null) {
return false;
}
// Roster entries never include a resource so remove the resource
// if it's a part of the XMPP address.
user = StringUtils.parseBareAddress(user);
synchronized (entries) {
for (Iterator i=entries.iterator(); i.hasNext(); ) {
RosterEntry entry = (RosterEntry)i.next();
if (entry.getUser().toLowerCase().equals(user.toLowerCase())) {
return true;
}
}
}
return false;
return getEntry(user) != null;
}
/**
@ -200,7 +187,7 @@ public class RosterGroup {
throw new XMPPException(response.getError());
}
// Add the new entry to the group since the server processed the request successfully
entries.add(entry);
addEntryLocal(entry);
}
}
@ -242,7 +229,7 @@ public class RosterGroup {
throw new XMPPException(response.getError());
}
// Remove the entry locally since the server processed the request successfully
entries.remove(entry);
removeEntryLocal(entry);
}
}