mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-06-15 16:14:49 +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:
parent
4964786ec9
commit
18677279f2
|
@ -375,10 +375,11 @@ public class Roster {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
String userLowerCase = user.toLowerCase();
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator i=entries.iterator(); i.hasNext(); ) {
|
for (Iterator i=entries.iterator(); i.hasNext(); ) {
|
||||||
RosterEntry entry = (RosterEntry)i.next();
|
RosterEntry entry = (RosterEntry)i.next();
|
||||||
if (entry.getUser().toLowerCase().equals(user.toLowerCase())) {
|
if (entry.getUser().equals(userLowerCase)) {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,18 +395,7 @@ public class Roster {
|
||||||
* @return true if the XMPP address is an entry in the roster.
|
* @return true if the XMPP address is an entry in the roster.
|
||||||
*/
|
*/
|
||||||
public boolean contains(String user) {
|
public boolean contains(String user) {
|
||||||
if (user == null) {
|
return getEntry(user) != null;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -541,11 +531,14 @@ public class Roster {
|
||||||
* @return the key to use in the presenceMap for the fully qualified xmpp ID.
|
* @return the key to use in the presenceMap for the fully qualified xmpp ID.
|
||||||
*/
|
*/
|
||||||
private String getPresenceMapKey(String user) {
|
private String getPresenceMapKey(String user) {
|
||||||
|
if (user == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String key = user;
|
String key = user;
|
||||||
if (!contains(user)) {
|
if (!contains(user)) {
|
||||||
key = StringUtils.parseBareAddress(user);
|
key = StringUtils.parseBareAddress(user);
|
||||||
}
|
}
|
||||||
return key;
|
return key.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -620,7 +613,7 @@ public class Roster {
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator i = entries.iterator(); i.hasNext();) {
|
for (Iterator i = entries.iterator(); i.hasNext();) {
|
||||||
RosterEntry entry = (RosterEntry) i.next();
|
RosterEntry entry = (RosterEntry) i.next();
|
||||||
if (entry.getUser().toLowerCase().equals(key.toLowerCase())) {
|
if (entry.getUser().equals(key)) {
|
||||||
fireRosterPresenceEvent(from);
|
fireRosterPresenceEvent(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,7 +634,7 @@ public class Roster {
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator i=entries.iterator(); i.hasNext(); ) {
|
for (Iterator i=entries.iterator(); i.hasNext(); ) {
|
||||||
RosterEntry entry = (RosterEntry)i.next();
|
RosterEntry entry = (RosterEntry)i.next();
|
||||||
if (entry.getUser().toLowerCase().equals(key.toLowerCase())) {
|
if (entry.getUser().equals(key)) {
|
||||||
fireRosterPresenceEvent(from);
|
fireRosterPresenceEvent(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class RosterEntry {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (object != null && object instanceof RosterEntry) {
|
if (object != null && object instanceof RosterEntry) {
|
||||||
return user.toLowerCase().equals(((RosterEntry)object).getUser().toLowerCase());
|
return user.equals(((RosterEntry)object).getUser());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -119,10 +119,11 @@ public class RosterGroup {
|
||||||
// Roster entries never include a resource so remove the resource
|
// Roster entries never include a resource so remove the resource
|
||||||
// if it's a part of the XMPP address.
|
// if it's a part of the XMPP address.
|
||||||
user = StringUtils.parseBareAddress(user);
|
user = StringUtils.parseBareAddress(user);
|
||||||
|
String userLowerCase = user.toLowerCase();
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator i=entries.iterator(); i.hasNext(); ) {
|
for (Iterator i=entries.iterator(); i.hasNext(); ) {
|
||||||
RosterEntry entry = (RosterEntry)i.next();
|
RosterEntry entry = (RosterEntry)i.next();
|
||||||
if (entry.getUser().toLowerCase().equals(user.toLowerCase())) {
|
if (entry.getUser().equals(userLowerCase)) {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,21 +150,7 @@ public class RosterGroup {
|
||||||
* @return true if the XMPP address is an entry in this group.
|
* @return true if the XMPP address is an entry in this group.
|
||||||
*/
|
*/
|
||||||
public boolean contains(String user) {
|
public boolean contains(String user) {
|
||||||
if (user == null) {
|
return getEntry(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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,7 +187,7 @@ public class RosterGroup {
|
||||||
throw new XMPPException(response.getError());
|
throw new XMPPException(response.getError());
|
||||||
}
|
}
|
||||||
// Add the new entry to the group since the server processed the request successfully
|
// 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());
|
throw new XMPPException(response.getError());
|
||||||
}
|
}
|
||||||
// Remove the entry locally since the server processed the request successfully
|
// Remove the entry locally since the server processed the request successfully
|
||||||
entries.remove(entry);
|
removeEntryLocal(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class RosterPacket extends IQ {
|
||||||
* @param name the user's name.
|
* @param name the user's name.
|
||||||
*/
|
*/
|
||||||
public Item(String user, String name) {
|
public Item(String user, String name) {
|
||||||
this.user = user;
|
this.user = user.toLowerCase();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
itemType = null;
|
itemType = null;
|
||||||
itemStatus = null;
|
itemStatus = null;
|
||||||
|
|
Loading…
Reference in a new issue