【问题标题】:strophe muc decline group invite stanzastrophe muc 下降组邀请节
【发布时间】:2013-12-11 20:38:46
【问题描述】:

您好,我在拒绝邀请加入聊天室时遇到问题。这是我的小节:

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

【问题讨论】:

    标签: javascript jquery xmpp strophe


    【解决方案1】:

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

    connection().send($msg({ to: toJid, 来自:fromJid}).c('x', { xmlns: 'jabber:x: 会议', 吉德:房间吉德, 行动:'拒绝'}).tree());

    【讨论】:

    • 谢谢,我会试试这个。我会及时通知您。
    • 我遇到了和以前一样的问题,我无法摆脱那个邀请消息。我已经发送了你的这节,但那是行不通的。有什么想法吗?
    • 好吧,我误读了你的内容。您需要一个具有命名空间“jabber.org/protocol/muc#user”的新处理程序(如果您有 muc 插件,则需要 MUC_USER)。然后你可以抓住“拒绝”元素并从那里进行评估。添加后,看看是否消除了多条消息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-07
    • 2017-03-22
    • 1970-01-01
    • 1970-01-01
    • 2016-12-26
    • 2011-10-10
    相关资源
    最近更新 更多