Client: New plugin manager implementation
[KiwiIRC.git] / client / assets / dev / utils.js
index de64451bbf1f583cb1052003bdf23e264dd80473..46482356f5de5f02670e91232254ea5f07e37518 100644 (file)
@@ -644,93 +644,6 @@ var plugins = [
 
 
 
-/**
-*   @namespace
-*/
-kiwi.plugs = {};
-/**
-*   Loaded plugins
-*/
-kiwi.plugs.loaded = {};
-/**
-*   Load a plugin
-*   @param      {Object}    plugin  The plugin to be loaded
-*   @returns    {Boolean}           True on success, false on failure
-*/
-kiwi.plugs.loadPlugin = function (plugin) {
-    var plugin_ret;
-    if (typeof plugin.name !== 'string') {
-        return false;
-    }
-
-    plugin_ret = kiwi.plugs.run('plugin_load', {plugin: plugin});
-    if (typeof plugin_ret === 'object') {
-        kiwi.plugs.loaded[plugin_ret.plugin.name] = plugin_ret.plugin;
-        kiwi.plugs.loaded[plugin_ret.plugin.name].local_data = new kiwi.dataStore('kiwi_plugin_' + plugin_ret.plugin.name);
-    }
-    kiwi.plugs.run('init', {}, {run_only: plugin_ret.plugin.name});
-
-    return true;
-};
-
-/**
-*   Unload a plugin
-*   @param  {String}    plugin_name The name of the plugin to unload
-*/
-kiwi.plugs.unloadPlugin = function (plugin_name) {
-    if (typeof kiwi.plugs.loaded[plugin_name] !== 'object') {
-        return;
-    }
-
-    kiwi.plugs.run('unload', {}, {run_only: plugin_name});
-    delete kiwi.plugs.loaded[plugin_name];
-};
-
-
-
-/**
-*   Run an event against all loaded plugins
-*   @param      {String}    event_name  The name of the event
-*   @param      {Object}    event_data  The data to pass to the plugin
-*   @param      {Object}    opts        Options
-*   @returns    {Object}                Event data, possibly modified by the plugins
-*/
-kiwi.plugs.run = function (event_name, event_data, opts) {
-    var ret = event_data,
-        ret_tmp,
-        plugin_name;
-
-    // Set some defaults if not provided
-    event_data = (typeof event_data === 'undefined') ? {} : event_data;
-    opts = (typeof opts === 'undefined') ? {} : opts;
-
-    for (plugin_name in kiwi.plugs.loaded) {
-        // If we're only calling 1 plugin, make sure it's that one
-        if (typeof opts.run_only === 'string' && opts.run_only !== plugin_name) {
-            continue;
-        }
-
-        if (typeof kiwi.plugs.loaded[plugin_name]['on' + event_name] === 'function') {
-            try {
-                ret_tmp = kiwi.plugs.loaded[plugin_name]['on' + event_name](ret, opts);
-                if (ret_tmp === null) {
-                    return null;
-                }
-                ret = ret_tmp;
-
-                if (typeof ret.event_bubbles === 'boolean' && ret.event_bubbles === false) {
-                    delete ret.event_bubbles;
-                    return ret;
-                }
-            } catch (e) {
-            }
-        }
-    }
-
-    return ret;
-};
-
-
 
 /**
 *   @constructor