diff lightstring.js @ 54:0b7dd59e264a

Fix Connection.load and add the init method to plugins.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 01 Feb 2012 04:08:15 +0100
parents 63c1c8bc8c19
children aaad98b33f86
line wrap: on
line diff
--- a/lightstring.js
+++ b/lightstring.js
@@ -394,14 +394,17 @@ Lightstring.Connection.prototype = {
       for (var ns in plugin.namespaces)
         Lightstring.ns[ns] = plugin.namespaces[ns];
 
+      Lightstring.stanzas[name] = {};
       for (var stanza in plugin.stanzas)
         Lightstring.stanzas[name][stanza] = plugin.stanzas[stanza];
 
       for (var handler in plugin.handlers)
         this.on(handler, plugin.handlers[handler]);
 
-      for (var method in plugin.methods)
-        this[name][method] = plugin.methods[method];
+      this[name] = plugin.methods;
+
+      if (plugin.init)
+        plugin.init();
     }
   },
   /**