git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6262 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2006-11-29 23:32:04 +00:00 committed by alex
parent c3aad4dec1
commit 7a16b8ff95
1 changed files with 3 additions and 10 deletions

View File

@ -432,20 +432,13 @@ public class Roster implements ConnectionListener {
else {
// Find the resource with the highest priority
// Might be changed to use the resource with the highest availability instead.
Iterator<String> it = userPresences.keySet().iterator();
Presence p;
Presence presence = null;
while (it.hasNext()) {
p = userPresences.get(it.next());
if (presence == null) {
for (String resource : userPresences.keySet()) {
Presence p = userPresences.get(resource);
if (presence == null || p.getPriority() > presence.getPriority()) {
presence = p;
}
else {
if (p.getPriority() > presence.getPriority()) {
presence = p;
}
}
}
return presence;
}