-
- if name == "iq" and xmlns == "jabber:client" and handlers[origin_type] then
- local child = stanza.tags[1];
- if child then
- local xmlns = child.attr.xmlns or xmlns;
- log("debug", "Stanza of type %s from %s has xmlns: %s", name, origin_type, xmlns);
- local handler = handlers[origin_type][name] and handlers[origin_type][name][xmlns];
- if handler then
- log("debug", "Passing stanza to mod_%s", handler_info[handler].name);
- return handler(origin, stanza) or true;
+ modulemap[host][name] = nil;
+ features_table:remove(host, name);
+ local params = handler_table:get(host, name); -- , {module.host, origin_type, tag, xmlns}
+ for _, param in pairs(params or NULL) do
+ local handlers = stanza_handlers:get(param[1], param[2], param[3], param[4]);
+ if handlers then
+ handler_info[handlers[1]] = nil;
+ stanza_handlers:remove(param[1], param[2], param[3], param[4]);
+ end
+ end
+ event_hooks:remove(host, name);
+ return true;
+end
+
+function reload(host, name, ...)
+ local mod = get_module(host, name);
+ if not mod then return nil, "module-not-loaded"; end
+
+ local _mod, err = loadfile(get_module_filename(name)); -- checking for syntax errors
+ if not _mod then
+ log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
+ return nil, err;
+ end
+
+ local saved;
+
+ if module_has_method(mod, "save") then
+ local ok, ret, err = call_module_method(mod, "save");
+ if ok then
+ saved = ret;
+ else
+ log("warn", "Error saving module '%s:%s' state: %s", host, module, ret);
+ if not config.get(host, "core", "force_module_reload") then
+ log("warn", "Aborting reload due to error, set force_module_reload to ignore this");
+ return nil, "save-state-failed";
+ else
+ log("warn", "Continuing with reload (using the force)");