How to get the Jabber ID for a Multi User Chat nick

Posted by Kutzi on Stack Overflow See other posts from Stack Overflow or by Kutzi
Published on 2010-03-21T12:18:31Z Indexed on 2010/03/21 12:21 UTC
Read the original article Hit count: 658

Filed under:
|
|

I'm trying to get the Jabber ID for a nick in a multi user chat, but the following code returns only null:

class JabberMUCMessageListenerAdapter implements PacketListener {

    private final MultiUserChat muc;

    public JabberMUCMessageListenerAdapter(MultiUserChat muc) {
         this.muc = muc;
    }

    @Override
    public void processPacket(Packet p) {
        if (p instanceof Message) {

            final Message msg = (Message) p;

            String jid = muc.getOccupant(msg.getFrom()).getJid(); // returns null

            ...
        }
    }
}

Does anyone know, what I'm doing wrong?

© Stack Overflow or respective owner

Related posts about smack

Related posts about xmpp