[muc] Rename local variable 'presence' to 'reflectedSelfPresence'

To increase readability, and with that maintainability, we rename
'presence' to 'reflectedSelfPresence' in MultiUserChat.enter(), to
make it clear what kind of presence this variable holds.

Also mark the variable as final.
This commit is contained in:
Florian Schmaus 2020-11-03 22:31:22 +01:00
parent 55d7b9d4eb
commit cfccc78ba0
1 changed files with 4 additions and 4 deletions

View File

@ -378,7 +378,7 @@ public class MultiUserChat {
// @formatter:on
StanzaCollector presenceStanzaCollector = null;
Presence presence;
final Presence reflectedSelfPresence;
try {
// This stanza collector will collect the final self presence from the MUC, which also signals that we have successful entered the MUC.
StanzaCollector selfPresenceCollector = connection.createStanzaCollectorAndSend(responseFilter, joinPresence);
@ -386,7 +386,7 @@ public class MultiUserChat {
// This stanza collector is used to reset the timeout of the selfPresenceCollector.
presenceStanzaCollector = connection.createStanzaCollector(presenceStanzaCollectorConfguration);
presence = selfPresenceCollector.nextResultOrThrow(conf.getTimeout());
reflectedSelfPresence = selfPresenceCollector.nextResultOrThrow(conf.getTimeout());
catch (NotConnectedException | InterruptedException | NoResponseException | XMPPErrorException e) {
// Ensure that all callbacks are removed if there is an exception
@ -401,12 +401,12 @@ public class MultiUserChat {
// This presence must be send from a full JID. We use the resourcepart of this JID as nick, since the room may
// performed roomnick rewriting
Resourcepart receivedNickname = presence.getFrom().getResourceOrThrow();
Resourcepart receivedNickname = reflectedSelfPresence.getFrom().getResourceOrThrow();
// Update the list of joined rooms
return presence;
return reflectedSelfPresence;
private void setNickname(Resourcepart nickname) {