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
1 changed files with 3 additions and 3 deletions

View File

@ -1634,7 +1634,7 @@ public class MultiUserChat {
* @return the occupant's current presence, or <tt>null</tt> if the user is unavailable
* or if no presence information is available.
*/
public Presence getOccupantPresence(String user) {
public Presence getOccupantPresence(EntityFullJid user) {
return occupantsMap.get(user);
}
@ -1647,8 +1647,8 @@ public class MultiUserChat {
* 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).
*/
public Occupant getOccupant(String user) {
Presence presence = occupantsMap.get(user);
public Occupant getOccupant(EntityFullJid user) {
Presence presence = getOccupantPresence(user);
if (presence != null) {
return new Occupant(presence);
}