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 (hosts[api_instance.host] or prosody).events.fire_event("module-loaded", { module = module_name, host = host }); |
162 return true; |
162 return true; |
163 else -- load failed, unloading |
163 else -- load failed, unloading |
164 unload(api_instance.host, module_name); |
164 unload(api_instance.host, module_name); |
165 return nil, err; |
165 return nil, err; |
166 end |
166 end |
208 hosts[host].events.fire_event("item-removed/"..key, {source = self, item = value}); |
208 hosts[host].events.fire_event("item-removed/"..key, {source = self, item = value}); |
209 end |
209 end |
210 end |
210 end |
211 end |
211 end |
212 modulemap[host][name] = nil; |
212 modulemap[host][name] = nil; |
213 hosts[host].events.fire_event("module-unloaded", { module = name, host = host }); |
213 (hosts[host] or prosody).events.fire_event("module-unloaded", { module = name, host = host }); |
214 return true; |
214 return true; |
215 end |
215 end |
216 |
216 |
217 function reload(host, name, ...) |
217 function reload(host, name, ...) |
218 local mod = get_module(host, name); |
218 local mod = get_module(host, name); |