开发者

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

开发者 https://www.devze.com 2022-12-24 16:38 出处:网络
I\'m trying to get the Jabber ID for a nick in a multi user chat, but the following code returns only null:

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
    p开发者_如何学Goublic 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?


http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smackx/muc/Occupant.html

The full JID and nickname are optional.

0

精彩评论

暂无评论...
验证码 换一张
取 消