1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

[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

View file

@ -378,7 +378,7 @@ public class MultiUserChat {
); );
// @formatter:on // @formatter:on
StanzaCollector presenceStanzaCollector = null; StanzaCollector presenceStanzaCollector = null;
Presence presence; final Presence reflectedSelfPresence;
try { try {
// This stanza collector will collect the final self presence from the MUC, which also signals that we have successful entered the MUC. // 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); StanzaCollector selfPresenceCollector = connection.createStanzaCollectorAndSend(responseFilter, joinPresence);
@ -386,7 +386,7 @@ public class MultiUserChat {
selfPresenceCollector).setStanzaFilter(presenceFromRoomFilter); selfPresenceCollector).setStanzaFilter(presenceFromRoomFilter);
// This stanza collector is used to reset the timeout of the selfPresenceCollector. // This stanza collector is used to reset the timeout of the selfPresenceCollector.
presenceStanzaCollector = connection.createStanzaCollector(presenceStanzaCollectorConfguration); presenceStanzaCollector = connection.createStanzaCollector(presenceStanzaCollectorConfguration);
presence = selfPresenceCollector.nextResultOrThrow(conf.getTimeout()); reflectedSelfPresence = selfPresenceCollector.nextResultOrThrow(conf.getTimeout());
} }
catch (NotConnectedException | InterruptedException | NoResponseException | XMPPErrorException e) { catch (NotConnectedException | InterruptedException | NoResponseException | XMPPErrorException e) {
// Ensure that all callbacks are removed if there is an exception // 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 // 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 // performed roomnick rewriting
Resourcepart receivedNickname = presence.getFrom().getResourceOrThrow(); Resourcepart receivedNickname = reflectedSelfPresence.getFrom().getResourceOrThrow();
setNickname(receivedNickname); setNickname(receivedNickname);
// Update the list of joined rooms // Update the list of joined rooms
multiUserChatManager.addJoinedRoom(room); multiUserChatManager.addJoinedRoom(room);
return presence; return reflectedSelfPresence;
} }
private void setNickname(Resourcepart nickname) { private void setNickname(Resourcepart nickname) {