modulemanager: Fire events module-loaded and module-unloaded, both receive a table...
authorMatthew Wild <mwild1@gmail.com>
Tue, 1 Dec 2009 19:57:33 +0000 (19:57 +0000)
committerMatthew Wild <mwild1@gmail.com>
Tue, 1 Dec 2009 19:57:33 +0000 (19:57 +0000)
core/modulemanager.lua

index d1f7d413cad3866201419766080e710aaef535ba..6440f8b82e389a3f701708b87cbec9ac52ccfa47 100644 (file)
@@ -158,6 +158,7 @@ function load(host, module_name, config)
                log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil");
        end
        if success then
+               hosts[host].events.fire_event("module-loaded", { module = module_name, host = host });
                return true;
        else -- load failed, unloading
                unload(api_instance.host, module_name);
@@ -200,6 +201,7 @@ function unload(host, name, ...)
        end
        hooks:remove(host, name);
        modulemap[host][name] = nil;
+       hosts[host].events.fire_event("module-unloaded", { module = name, host = host });
        return true;
 end