X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_uptime.lua;h=2e369b16f38a25ab21d363bfe7ebb90171eda64f;hb=73e841ddd082009e3f19502b207231bbddfa0dbb;hp=c3860af6535508ea58200bc06657f6a644fa6659;hpb=bca1a48421947ca7d627c23433effed81a1d91f2;p=prosody.git diff --git a/plugins/mod_uptime.lua b/plugins/mod_uptime.lua index c3860af6..2e369b16 100644 --- a/plugins/mod_uptime.lua +++ b/plugins/mod_uptime.lua @@ -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