您好,我在拒绝聊天室邀请时遇到了问题。这是我的节:
var msg = $msg({"from" : tojid,"to" : room}).c("x", {"xmlns" : Strophe.NS.MUC_USER}).c("decline", {"to" : fromjid+"@188.2.16.19"});
msg.c("reason").t("Can talk right now.");
Chat.connection.send(msg.tree());
但这不是第一次发送,邀请也不会被拒绝。它一直在返回。 如果我在发件人端发送两次,我会收到回复:
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns="jabber:client" from="epthi_702@conference.188.2.16.19" to="nikola_degree361_com@188.2.16.19"><x xmlns="http://jabber.org/protocol/muc#user"><decline from="nikola_pregmatch_org@188.2.16.19"><reason>Can talk right now.</reason></decline></x></message></body>
我也想不出这个的处理程序。在 strophe addHandler 中放什么? 来自群组邀请我有:
Chat.connection.addHandler(Chat.onInvite,"jabber:x:conference");
最佳答案
我添加了一个“Action”属性并使用相同的命名空间返回它。我的“onInvite”处理程序查找“action==='deny'并相应地处理它。
connection().send($msg({ 到:toJid, 来自:fromJid}).c('x', { xmlns: 'jabber:x:conference', jid: roomJid, Action :'拒绝'}).tree());
关于javascript - strophe muc decline group 邀请节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20529447/