diff options
Diffstat (limited to 'app/xmpp/index.js')
-rw-r--r-- | app/xmpp/index.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/app/xmpp/index.js b/app/xmpp/index.js index dce0053..8017f5a 100644 --- a/app/xmpp/index.js +++ b/app/xmpp/index.js @@ -47,7 +47,7 @@ function xmppStart(core) { var conn = new XmppConnection(user, client); core.presence.connect(conn); - + cb(null, opts); }); }); @@ -61,11 +61,40 @@ function xmppStart(core) { return processor.run(); }); - if (!handled && settings.xmpp.debug.unhandled) { + if (handled) { + return; + } + + if (settings.xmpp.debug.unhandled) { // Print unhandled request console.log(' '); console.log(stanza.root().toString().red); } + + if (stanza.name !== 'iq') { + return; + } + + var msg = new Stanza.Iq({ + type: 'error', + id: stanza.attrs.id, + to: stanza.attrs.from, + from: stanza.attrs.to + }); + + msg.c('not-implemented', { + code: 501, + type: 'CANCEL' + }).c('feature-not-implemented', { + xmlns: 'urn:ietf:params:xml:n:xmpp-stanzas' + }); + + + if (settings.xmpp.debug.unhandled) { + console.log(msg.root().toString().green); + } + + client.send(msg); }); // On Disconnect event. When a client disconnects |