strophe muc衰落组邀请节

时间:2013-12-11 20:38:46

标签: javascript jquery xmpp strophe

嗨我在拒绝邀请聊天室时遇到问题。这是我的节目:

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");

1 个答案:

答案 0 :(得分:1)

我添加了一个“Action”属性,并使用相同的命名空间返回它。我的“onInvite”处理程序查找“action ==='deny'并相应地处理它。

连接()。发送($ MSG({ to:toJid, 来自:fromJid})。c('x',{ xmlns:'jabber:x:conference', jid:roomJid, 动作:'deny'})。tree());