stanza_dispatch = core_process_stanza, fixed for xmpp{client,server} listeners, and...
[prosody.git] / prosody
diff --git a/prosody b/prosody
index 9fd5e4ff6c00c31409d8e909f6bf050a5e55d1a2..042d0212816fdb017135e8dcdbc6b1e76e4d6cf6 100755 (executable)
--- a/prosody
+++ b/prosody
@@ -68,8 +68,6 @@ do
        end
 end
 
-require "util.datamanager".set_data_path(data_path);
-
 local server = require "net.server"
 
 require "util.dependencies"
@@ -78,7 +76,6 @@ require "util.dependencies"
 sessions = {};
 hosts = {};
 
-
 -- Load and initialise core modules --
 
 require "util.import"
@@ -104,14 +101,17 @@ require "util.jid"
 
 ------------------------------------------------------------------------
 
+
 ------------- Begin code without a home ---------------------
 
 local data_path = config.get("*", "core", "data_path") or CFG_DATADIR or "data";
+require "util.datamanager".set_data_path(data_path);
+
+
 local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end
 local _mkdir = {}
 function mkdir(path)
        path = path:gsub("/", path_separator);
-       --print("mkdir",path);
        local x = io.popen("mkdir \""..path.."\" 2>&1"):read("*a");
 end
 function encode(s) return s and (s:gsub("%W", function (c) return string.format("%%%x", c:byte()); end)); end
@@ -135,25 +135,9 @@ eventmanager.add_event_hook("host-activated", mkdirs);
 
 eventmanager.fire_event("server-starting");
 
--- Initialise modules
-
-for host in pairs(hosts) do
-       if host ~= "*" then
-               local modules_enabled = config.get(host, "core", "modules_enabled");
-               if modules_enabled then
-                       for _, module in pairs(modules_enabled) do
-                               modulemanager.load(host, module);
-                       end
-               end
-       end
-end
 
 -- setup error handling
-setmetatable(_G, { __index = function (t, k) print("WARNING: ATTEMPT TO READ A NIL GLOBAL!!!", k); error("Attempt to read a non-existent global. Naughty boy.", 2); end, __newindex = function (t, k, v) print("ATTEMPT TO SET A GLOBAL!!!!", tostring(k).." = "..tostring(v)); error("Attempt to set a global. Naughty boy.", 2); end }) --]][][[]][];
-
-local protected_handler = function (conn, data, err) local success, ret = pcall(handler, conn, data, err); if not success then print("ERROR on "..tostring(conn)..": "..ret); conn:close(); end end;
-local protected_disconnect = function (conn, err) local success, ret = pcall(disconnect, conn, err); if not success then print("ERROR on "..tostring(conn).." disconnect: "..ret); conn:close(); end end;
-
+setmetatable(_G, { __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end, __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end });
 
 local global_ssl_ctx = config.get("*", "core", "ssl");
 if global_ssl_ctx then