mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-19 02:22:05 +01:00
[muc] Only retrieve MUCUser once in Presence listener
This commit is contained in:
parent
5dfed2935f
commit
f12fe2264a
1 changed files with 3 additions and 4 deletions
|
@ -195,6 +195,7 @@ public class MultiUserChat {
|
|||
}
|
||||
final EntityFullJid myRoomJID = myRoomJid;
|
||||
final boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
|
||||
final MUCUser mucUser = MUCUser.from(packet);
|
||||
|
||||
switch (presence.getType()) {
|
||||
case available:
|
||||
|
@ -205,9 +206,8 @@ public class MultiUserChat {
|
|||
MUCAffiliation oldAffiliation = mucExtension.getItem().getAffiliation();
|
||||
MUCRole oldRole = mucExtension.getItem().getRole();
|
||||
// Get the new occupant's affiliation & role
|
||||
mucExtension = MUCUser.from(packet);
|
||||
MUCAffiliation newAffiliation = mucExtension.getItem().getAffiliation();
|
||||
MUCRole newRole = mucExtension.getItem().getRole();
|
||||
MUCAffiliation newAffiliation = mucUser.getItem().getAffiliation();
|
||||
MUCRole newRole = mucUser.getItem().getRole();
|
||||
// Fire role modification events
|
||||
checkRoleModifications(oldRole, newRole, isUserStatusModification, from);
|
||||
// Fire affiliation modification events
|
||||
|
@ -228,7 +228,6 @@ public class MultiUserChat {
|
|||
break;
|
||||
case unavailable:
|
||||
occupantsMap.remove(from);
|
||||
MUCUser mucUser = MUCUser.from(packet);
|
||||
if (mucUser != null && mucUser.hasStatus()) {
|
||||
if (isUserStatusModification) {
|
||||
userHasLeft();
|
||||
|
|
Loading…
Reference in a new issue