aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-06-20 12:16:20 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-06-20 12:16:20 +0500
commit72d328bf9597fa6bec876773173976769c4d1402 (patch)
tree4f40432a952a4f8bb0d1b057decc93056c466859 /prosody
parent0405ab8738672fb4b23de8231cd49934e8d95ffa (diff)
downloadprosody-72d328bf9597fa6bec876773173976769c4d1402.tar.gz
prosody-72d328bf9597fa6bec876773173976769c4d1402.zip
Fire global events using prosody.events
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody8
1 files changed, 8 insertions, 0 deletions
diff --git a/prosody b/prosody
index 08ee6cf0..afff290f 100755
--- a/prosody
+++ b/prosody
@@ -145,6 +145,7 @@ end);
function prosody.reload_config()
log("info", "Reloading configuration file");
eventmanager.fire_event("reloading-config");
+ prosody.events.fire_event("reloading-config", {});
local ok, level, err = config.load((rawget(_G, "CFG_CONFIGDIR") or ".").."/prosody.cfg.lua");
if not ok then
if level == "parser" then
@@ -159,17 +160,20 @@ end
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
-- Function to initiate prosody shutdown
function prosody.shutdown(reason)
log("info", "Shutting down: %s", reason or "unknown reason");
eventmanager.fire_event("server-stopping", { reason = reason });
+ prosody.events.fire_event("server-stopping", {});
server.setquitting(true);
end
-- Signal to modules that we are ready to start
eventmanager.fire_event("server-starting");
+prosody.events.fire_event("server-starting", {});
-- Load SSL settings from config, and create a ctx table
local global_ssl_ctx = ssl and config.get("*", "core", "ssl");
@@ -227,6 +231,7 @@ end
prosody.lock_globals();
eventmanager.fire_event("server-started");
+prosody.events.fire_event("server-started", {});
-- Error handler for errors that make it this far
local function catch_uncaught_error(err)
@@ -241,6 +246,7 @@ local function catch_uncaught_error(err)
end
eventmanager.fire_event("very-bad-error", "*", err, traceback);
+ prosody.events.fire_event("very-bad-error", {error = err, traceback = traceback});
end
while select(2, xpcall(server.loop, catch_uncaught_error)) ~= "quitting" do
@@ -249,6 +255,7 @@ end
log("info", "Shutdown status: Cleaning up");
eventmanager.fire_event("server-cleanup");
+prosody.events.fire_event("server-cleanup", {});
-- Ok, we're quitting I know, but we
-- need to do some tidying before we go :)
@@ -284,4 +291,5 @@ server.closeall();
server.setquitting(true);
eventmanager.fire_event("server-stopped");
+prosody.events.fire_event("server-stopped", {});
log("info", "Shutdown status: Complete!");