changeset 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 d1a7895b3dce
children aaad98b33f86
files lightstring.js
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
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();
     }
   },
   /**