diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
index 22727c931..1064ee59d 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
@@ -205,7 +205,7 @@ public class MultiUserChat {
if (from == null) {
return;
}
- final EntityFullJid myRoomJID = myRoomJid;
+ final EntityFullJid myRoomJID = getMyRoomJid();
final boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
final MUCUser mucUser = MUCUser.from(packet);
@@ -732,7 +732,7 @@ public class MultiUserChat {
* @return true if currently in the multi user chat room.
*/
public boolean isJoined() {
- return myRoomJid != null;
+ return getMyRoomJid() != null;
}
/**
@@ -768,7 +768,7 @@ public class MultiUserChat {
// "if (!joined) return" because it should be always be possible to leave the room in case the instance's
// state does not reflect the actual state.
- final EntityFullJid myRoomJid = this.myRoomJid;
+ final EntityFullJid myRoomJid = getMyRoomJid();
if (myRoomJid == null) {
throw new MucNotJoinedException(this);
}
@@ -1200,13 +1200,23 @@ public class MultiUserChat {
* @return the nickname currently being used.
*/
public Resourcepart getNickname() {
- final EntityFullJid myRoomJid = this.myRoomJid;
+ final EntityFullJid myRoomJid = getMyRoomJid();
if (myRoomJid == null) {
return null;
}
return myRoomJid.getResourcepart();
}
+ /**
+ * Return the full JID of the user in the room, or null
if the room is not joined.
+ *
+ * @return the full JID of the user in the room, or null
.
+ * @since 4.5.0
+ */
+ public EntityFullJid getMyRoomJid() {
+ return myRoomJid;
+ }
+
/**
* Changes the occupant's nickname to a new nickname within the room. Each room occupant
* will receive two presence packets. One of type "unavailable" for the old nickname and one
@@ -1263,7 +1273,7 @@ public class MultiUserChat {
* @throws MucNotJoinedException if not joined to the Multi-User Chat.
*/
public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException, InterruptedException, MucNotJoinedException {
- final EntityFullJid myRoomJid = this.myRoomJid;
+ final EntityFullJid myRoomJid = getMyRoomJid();
if (myRoomJid == null) {
throw new MucNotJoinedException(this);
}