Merge Tobias SCRAM-PLUS work
[prosody.git] / plugins / mod_uptime.lua
index c3860af6535508ea58200bc06657f6a644fa6659..2e369b16f38a25ab21d363bfe7ebb90171eda64f 100644 (file)
@@ -1,7 +1,7 @@
 -- Prosody IM
 -- Copyright (C) 2008-2010 Matthew Wild
 -- Copyright (C) 2008-2010 Waqas Hussain
--- 
+--
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
 --
@@ -9,7 +9,7 @@
 local st = require "util.stanza";
 
 local start_time = prosody.start_time;
-prosody.events.add_handler("server-started", function() start_time = prosody.start_time end);
+module:hook_global("server-started", function() start_time = prosody.start_time end);
 
 -- XEP-0012: Last activity
 module:add_feature("jabber:iq:last");
@@ -34,8 +34,8 @@ function uptime_text()
        local hours = t%24;
        t = (t - hours)/24;
        local days = t;
-       return string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", 
-               days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", 
+       return string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)",
+               days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "",
                minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
 end