Comparison

core/modulemanager.lua @ 2270:97f25da177af

modulemanager: Fire events module-loaded and module-unloaded, both receive a table with 'module' and 'host' fields, thanks bjc
author Matthew Wild <mwild1@gmail.com>
date Tue, 01 Dec 2009 19:57:33 +0000
parent 2151:3bb7c1daa93f
child 2278:8c10f13c0c20
comparison
equal deleted inserted replaced
2265:7fe644057dc2 2270:97f25da177af
156 end 156 end
157 else 157 else
158 log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil"); 158 log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil");
159 end 159 end
160 if success then 160 if success then
161 hosts[host].events.fire_event("module-loaded", { module = module_name, host = host });
161 return true; 162 return true;
162 else -- load failed, unloading 163 else -- load failed, unloading
163 unload(api_instance.host, module_name); 164 unload(api_instance.host, module_name);
164 return nil, err; 165 return nil, err;
165 end 166 end
198 (hosts[host] or prosody).events.remove_handler(event, handler); 199 (hosts[host] or prosody).events.remove_handler(event, handler);
199 end 200 end
200 end 201 end
201 hooks:remove(host, name); 202 hooks:remove(host, name);
202 modulemap[host][name] = nil; 203 modulemap[host][name] = nil;
204 hosts[host].events.fire_event("module-unloaded", { module = name, host = host });
203 return true; 205 return true;
204 end 206 end
205 207
206 function reload(host, name, ...) 208 function reload(host, name, ...)
207 local mod = get_module(host, name); 209 local mod = get_module(host, name);