mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-01 01:35:59 +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 EntityFullJid myRoomJID = myRoomJid;
|
||||||
final boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
|
final boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
|
||||||
|
final MUCUser mucUser = MUCUser.from(packet);
|
||||||
|
|
||||||
switch (presence.getType()) {
|
switch (presence.getType()) {
|
||||||
case available:
|
case available:
|
||||||
|
@ -205,9 +206,8 @@ public class MultiUserChat {
|
||||||
MUCAffiliation oldAffiliation = mucExtension.getItem().getAffiliation();
|
MUCAffiliation oldAffiliation = mucExtension.getItem().getAffiliation();
|
||||||
MUCRole oldRole = mucExtension.getItem().getRole();
|
MUCRole oldRole = mucExtension.getItem().getRole();
|
||||||
// Get the new occupant's affiliation & role
|
// Get the new occupant's affiliation & role
|
||||||
mucExtension = MUCUser.from(packet);
|
MUCAffiliation newAffiliation = mucUser.getItem().getAffiliation();
|
||||||
MUCAffiliation newAffiliation = mucExtension.getItem().getAffiliation();
|
MUCRole newRole = mucUser.getItem().getRole();
|
||||||
MUCRole newRole = mucExtension.getItem().getRole();
|
|
||||||
// Fire role modification events
|
// Fire role modification events
|
||||||
checkRoleModifications(oldRole, newRole, isUserStatusModification, from);
|
checkRoleModifications(oldRole, newRole, isUserStatusModification, from);
|
||||||
// Fire affiliation modification events
|
// Fire affiliation modification events
|
||||||
|
@ -228,7 +228,6 @@ public class MultiUserChat {
|
||||||
break;
|
break;
|
||||||
case unavailable:
|
case unavailable:
|
||||||
occupantsMap.remove(from);
|
occupantsMap.remove(from);
|
||||||
MUCUser mucUser = MUCUser.from(packet);
|
|
||||||
if (mucUser != null && mucUser.hasStatus()) {
|
if (mucUser != null && mucUser.hasStatus()) {
|
||||||
if (isUserStatusModification) {
|
if (isUserStatusModification) {
|
||||||
userHasLeft();
|
userHasLeft();
|
||||||
|
|
Loading…
Reference in a new issue