diff plugins/disco.js @ 76:0b8e7ca19f83

Plugins init functions are now called with Lightstring.Connection scope.
author Sonny Piers <sonny.piers@gmail.com>
date Mon, 06 Feb 2012 18:02:02 +0100
parents 5dbf93cef55d
children 50d36b093e3a
line wrap: on
line diff
--- 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 = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" +
                             " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" +
                             " type='error'/>"; //TODO: precise the error.
-          conn.send(response);
+          this.send(response);
           return true;
         }
 
@@ -167,7 +167,7 @@
         res += "</query>" +
              "</iq>";
 
-        conn.send(res);
+        this.send(res);
         return true;
       });
     }