1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Use EntityFullJid in MUC's getOccupant(Presence) API

instead of String, which will always return null if used with
ocupantsMap.get(String), because String.equals(Object) is only true if
Object is also instanceof String.

Thanks to Adnan Elezovic for reporting.
This commit is contained in:
Florian Schmaus 2015-08-12 10:16:48 +02:00
parent f9faebe831
commit d711caee38

View file

@ -1634,7 +1634,7 @@ public class MultiUserChat {
* @return the occupant's current presence, or <tt>null</tt> if the user is unavailable * @return the occupant's current presence, or <tt>null</tt> if the user is unavailable
* or if no presence information is available. * or if no presence information is available.
*/ */
public Presence getOccupantPresence(String user) { public Presence getOccupantPresence(EntityFullJid user) {
return occupantsMap.get(user); return occupantsMap.get(user);
} }
@ -1647,8 +1647,8 @@ public class MultiUserChat {
* be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch). * be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch).
* @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room). * @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room).
*/ */
public Occupant getOccupant(String user) { public Occupant getOccupant(EntityFullJid user) {
Presence presence = occupantsMap.get(user); Presence presence = getOccupantPresence(user);
if (presence != null) { if (presence != null) {
return new Occupant(presence); return new Occupant(presence);
} }