1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 13:07:59 +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:
Gaston Dombiak 2005-02-02 22:42:57 +00:00 committed by gaston
parent e42ba10a3d
commit f5c17aa6f3
2 changed files with 4 additions and 0 deletions

View file

@ -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());
}
/**

View file

@ -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