1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 16:22:06 +01:00

Use entries.containsKey in Roster

This commit is contained in:
Florian Schmaus 2014-12-29 18:20:11 +01:00
parent 5d5e3c05c5
commit c8631cf45c

View file

@ -850,7 +850,6 @@ public class Roster {
String from = presence.getFrom(); String from = presence.getFrom();
String key = getPresenceMapKey(from); String key = getPresenceMapKey(from);
Map<String, Presence> userPresences; Map<String, Presence> userPresences;
RosterEntry entry;
Presence response = null; Presence response = null;
// If an "available" presence, add it to the presence map. Each presence // If an "available" presence, add it to the presence map. Each presence
@ -872,8 +871,7 @@ public class Roster {
// Add the new presence, using the resources as a key. // Add the new presence, using the resources as a key.
userPresences.put(XmppStringUtils.parseResource(from), presence); userPresences.put(XmppStringUtils.parseResource(from), presence);
// If the user is in the roster, fire an event. // If the user is in the roster, fire an event.
entry = entries.get(key); if (entries.containsKey(key)) {
if (entry != null) {
fireRosterPresenceEvent(presence); fireRosterPresenceEvent(presence);
} }
break; break;
@ -900,8 +898,7 @@ public class Roster {
userPresences.put(XmppStringUtils.parseResource(from), presence); userPresences.put(XmppStringUtils.parseResource(from), presence);
} }
// If the user is in the roster, fire an event. // If the user is in the roster, fire an event.
entry = entries.get(key); if (entries.containsKey(key)) {
if (entry != null) {
fireRosterPresenceEvent(presence); fireRosterPresenceEvent(presence);
} }
break; break;
@ -954,8 +951,7 @@ public class Roster {
// Set the new presence using the empty resource as a key. // Set the new presence using the empty resource as a key.
userPresences.put("", presence); userPresences.put("", presence);
// If the user is in the roster, fire an event. // If the user is in the roster, fire an event.
entry = entries.get(key); if (entries.containsKey(key)) {
if (entry != null) {
fireRosterPresenceEvent(presence); fireRosterPresenceEvent(presence);
} }
break; break;