plugins/mod_uptime.lua
changeset 8347 071c0523c4cb
parent 5776 bd0ff8ae98a8
child 8965 6c06bd455bbf
equal deleted inserted replaced
8346:5df2f240173b 8347:071c0523c4cb
    37 	return string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)",
    37 	return string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)",
    38 		days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "",
    38 		days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "",
    39 		minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
    39 		minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
    40 end
    40 end
    41 
    41 
    42 function uptime_command_handler (self, data, state)
    42 function uptime_command_handler ()
    43 	return { info = uptime_text(), status = "completed" };
    43 	return { info = uptime_text(), status = "completed" };
    44 end
    44 end
    45 
    45 
    46 local descriptor = adhoc_new("Get uptime", "uptime", uptime_command_handler);
    46 local descriptor = adhoc_new("Get uptime", "uptime", uptime_command_handler);
    47 
    47