如何获取多用户聊天昵称的 Jabber ID
我试图在多用户聊天中获取昵称的 Jabber ID,但以下代码仅返回 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
...
}
}
}
有谁知道我做错了什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smackx/muc/Occupant.html igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smackx/muc/Occupant.html
http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smackx/muc/Occupant.html