# HG changeset patch # User Emmanuel Gil Peyrot # Date 1328053269 -3600 # Node ID ea276b47c55517b622ae903ddf21c4985c3625d7 # Parent f23e4741a7c5b06953015d4e86978042dd9de3bd Fix feature-not-implemented plugin. diff --git a/plugins/feature-not-implemented.js b/plugins/feature-not-implemented.js --- a/plugins/feature-not-implemented.js +++ b/plugins/feature-not-implemented.js @@ -16,36 +16,38 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -Lightstring.NS.xmpp_stanzas = 'urn:ietf:params:xml:ns:xmpp-stanzas'; +Lightstring.plugins['feature-not-implemented'] = { + namespaces: { + xmpp_stanzas: 'urn:ietf:params:xml:ns:xmpp-stanzas' + }, + handlers: { + 'iq': function callback(stanza) { + var type = stanza.DOM.getAttributeNS(null, 'type'); + if (type !== 'get' && type !== 'set') + return; -function register_feature_not_implemented() { - var conn = this; - conn.on('iq', function callback(stanza) { - var type = stanza.DOM.getAttributeNS(null, 'type'); - if (type !== 'get' && type !== 'set') - return; + var handlers = conn.handlers; + var events = [handlers['iq']]; - var handlers = conn.handlers; - var events = [handlers['iq']]; - - var payload = stanza.DOM.firstChild; - if (payload) - events.push('iq/' + payload.namespaceURI + ':' + payload.localName); + var payload = stanza.DOM.firstChild; + if (payload) + events.push('iq/' + payload.namespaceURI + ':' + payload.localName); - var only = events.every(function(handler) { - for (var i in handler) - if (callback !== handler[i]) - return false; - return true; - }); + var only = events.every(function(handler) { + for (var i in handler) + if (callback !== handler[i]) + return false; + return true; + }); - if (only) - conn.send("" + - "" + - "" + - "" + - ""); - }); + if (only) + conn.send("" + + "" + + "" + + "" + + ""); + } + } };