Hi I am having problems on decline invite to chat room. This is my stanza:
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());
But that is not sent first time and invitation is not declined. It keeps returning all time. If I send that twice on sender end I have response:
<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns="jabber:client" from="[email protected]" to="[email protected]"><x xmlns="http://jabber.org/protocol/muc#user"><decline from="[email protected]"><reason>Can talk right now.</reason></decline></x></message></body>
Also I can not figure out handler for this. What to put in strophe addHandler? Fro group invite I have :
Chat.connection.addHandler(Chat.onInvite,"jabber:x:conference");
I added an "Action" attribute and returned it using the same namespace. My "onInvite" handler looks for the "action==='deny' and handles it accordingly.
connection().send($msg({ to: toJid, from: fromJid}).c('x', { xmlns: 'jabber:x:conference', jid: roomJid, action: 'deny' }).tree());