gpt4 book ai didi

java - 邀请监听器不工作 smack 4.1

转载 作者:行者123 更新时间:2023-11-29 19:26:15 25 4
gpt4 key购买 nike

我在我的应用程序中使用 smack 4.1,我可以发送邀请,但我没有收到邀请

事实上,在调试时,我在 ChatMessageListener() 中收到了邀请,在数据包扩展中我可以获得整个邀请,但我不想削减 XML。

我的 InvitationLisenter() 从未调用过

final MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
manager.addInvitationListener(new InvitationListener() {
@Override
public void invitationReceived(XMPPConnection xmppConnection, MultiUserChat multiUserChat, String s, String s1, String s2, Message message) {
try {
multiUserChat.join(mUserName);
} catch (SmackException.NoResponseException e) {
e.printStackTrace();
} catch (XMPPException.XMPPErrorException e) {
e.printStackTrace();
} catch (SmackException.NotConnectedException e) {
e.printStackTrace();
}
}
});

最佳答案

xmpp中有两种类型的房间邀请,

直接邀请

作为普通消息发送并通过 ChatMessageListener() 接收,我正在使用此代码从消息中获取邀请

GroupChatInvitation invite = (GroupChatInvitation)result.getExtension("x","jabber:x:conference");


调解邀请

通过 InvitationLisenter() 接收

关于java - 邀请监听器不工作 smack 4.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41355059/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com