# HG changeset patch # User Sonny Piers # Date 1328547722 -3600 # Node ID 0b8e7ca19f836ea73649ba502c200c9c3620433c # Parent 619f3ffa125a6ffadd244a2f6096403f6fa82308 Plugins init functions are now called with Lightstring.Connection scope. diff --git a/lightstring.js b/lightstring.js --- a/lightstring.js +++ b/lightstring.js @@ -321,7 +321,7 @@ Lightstring.Connection.prototype = { this[name][method] = plugin.methods[method].bind(this); if (plugin.init) - plugin.init(); + plugin.init.apply(this); } }, /** diff --git a/plugins/disco.js b/plugins/disco.js --- a/plugins/disco.js +++ b/plugins/disco.js @@ -131,7 +131,7 @@ } }, init: function() { - conn.on('iq/' + Lightstring.ns['disco#info'] + ':query', function(stanza) { + this.on('iq/' + Lightstring.ns['disco#info'] + ':query', function(stanza) { if (stanza.DOM.getAttributeNS(null, 'type') !== 'get') return false; @@ -140,7 +140,7 @@ var response = ""; //TODO: precise the error. - conn.send(response); + this.send(response); return true; } @@ -167,7 +167,7 @@ res += "" + ""; - conn.send(res); + this.send(res); return true; }); }