mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 11:07:57 +01:00
Fixed to get the nickname of an occupant based on his presence. SMACK-43
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2453 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
e42ba10a3d
commit
f5c17aa6f3
2 changed files with 4 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue