prosody: Lowered log level for a log message.
authorWaqas Hussain <waqas20@gmail.com>
Fri, 7 May 2010 11:00:33 +0000 (16:00 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Fri, 7 May 2010 11:00:33 +0000 (16:00 +0500)
prosody

diff --git a/prosody b/prosody
index 8e96eb46ac88d1cfdc42bf146a0570928686bd17..0232b83b704a81ef90992c0e551835135d985de4 100755 (executable)
--- a/prosody
+++ b/prosody
@@ -22,6 +22,9 @@ if CFG_SOURCEDIR then
        package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath;
 end
 
+package.path = package.path..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.lua";
+package.cpath = package.cpath..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.so";
+
 -- Substitute ~ with path to home directory in data path
 if CFG_DATADIR then
        if os.getenv("HOME") then
@@ -29,10 +32,6 @@ if CFG_DATADIR then
        end
 end
 
--- Global 'prosody' object
-prosody = { events = require "util.events".new(); };
-local prosody = prosody;
-
 -- Load the config-parsing module
 config = require "core.configmanager"
 
@@ -152,6 +151,10 @@ function init_global_state()
        full_sessions = {};
        hosts = {};
 
+       -- Global 'prosody' object
+       prosody = {};
+       local prosody = prosody;
+       
        prosody.bare_sessions = bare_sessions;
        prosody.full_sessions = full_sessions;
        prosody.hosts = hosts;
@@ -161,6 +164,8 @@ function init_global_state()
        
        prosody.arg = _G.arg;
 
+       prosody.events = require "util.events".new();
+       
        prosody.platform = "unknown";
        if os.getenv("WINDIR") then
                prosody.platform = "windows";
@@ -191,6 +196,7 @@ function init_global_state()
        -- Function to reopen logfiles
        function prosody.reopen_logfiles()
                log("info", "Re-opening log files");
+               eventmanager.fire_event("reopen-log-files"); -- Handled by appropriate log sinks
                prosody.events.fire_event("reopen-log-files");
        end
 
@@ -283,6 +289,7 @@ function load_secondary_libraries()
        require "util.import"
        require "core.xmlhandlers"
        require "core.rostermanager"
+       require "core.eventmanager"
        require "core.hostmanager"
        require "core.modulemanager"
        require "core.usermanager"
@@ -324,8 +331,9 @@ function init_data_store()
 end
 
 function prepare_to_start()
-       log("info", "Prosody is using the %s backend for connection handling", server.get_backend());
+       log("debug", "Prosody is using the %s backend for connection handling", server.get_backend());
        -- Signal to modules that we are ready to start
+       eventmanager.fire_event("server-starting");
        prosody.events.fire_event("server-starting");
 
        -- start listening on sockets
@@ -443,12 +451,14 @@ init_data_store();
 init_global_protection();
 prepare_to_start();
 
+eventmanager.fire_event("server-started");
 prosody.events.fire_event("server-started");
 
 loop();
 
 log("info", "Shutting down...");
 cleanup();
+eventmanager.fire_event("server-stopped");
 prosody.events.fire_event("server-stopped");
 log("info", "Shutdown complete");