diff --git a/source/org/jivesoftware/smackx/muc/Occupant.java b/source/org/jivesoftware/smackx/muc/Occupant.java index e497387a5..e82de84ad 100644 --- a/source/org/jivesoftware/smackx/muc/Occupant.java +++ b/source/org/jivesoftware/smackx/muc/Occupant.java @@ -23,6 +23,7 @@ package org.jivesoftware.smackx.muc; import org.jivesoftware.smackx.packet.MUCAdmin; import org.jivesoftware.smackx.packet.MUCUser; import org.jivesoftware.smack.packet.Presence; +import org.jivesoftware.smack.util.StringUtils; /** * Represents the information about an occupant in a given room. The information will always have @@ -54,6 +55,8 @@ public class Occupant { this.jid = item.getJid(); this.affiliation = item.getAffiliation(); this.role = item.getRole(); + // Get the nickname from the FROM attribute of the presence + this.nick = StringUtils.parseResource(presence.getFrom()); } /** diff --git a/test/org/jivesoftware/smackx/muc/MultiUserChatTest.java b/test/org/jivesoftware/smackx/muc/MultiUserChatTest.java index b79629fd3..936b21cbd 100644 --- a/test/org/jivesoftware/smackx/muc/MultiUserChatTest.java +++ b/test/org/jivesoftware/smackx/muc/MultiUserChatTest.java @@ -1576,6 +1576,7 @@ public class MultiUserChatTest extends SmackTestCase { assertEquals("Wrong occupant jid", getFullJID(1), occupant.getJid()); assertEquals("Wrong occupant affiliation", "member", occupant.getAffiliation()); assertEquals("Wrong occupant role", "participant", occupant.getRole()); + assertEquals("Wrong occupant nick", "testbot2", occupant.getNick()); try { // Check whether a member can get the list of owners