Software /
code /
prosody-modules
File
mod_adhoc_cmd_uptime/mod_adhoc_cmd_uptime.lua @ 94:941fd7d8b9b2
mod_muc_log: split into mod_muc_log and mod_muc_log_http
mod_muc_log: should be enabled per muc component which should log!
mod_muc_log_http: handle /me messages, add previous, next day links to day view, add link to speeqe.com to directly join the room,
make the window recalculate the content div size, scrollbars are only shown when needed
author | Thilo Cestonaro <thilo@cestona.ro> |
---|---|
date | Tue, 17 Nov 2009 21:19:17 +0100 |
parent | 38:b9bf8a35b064 |
child | 109:9b63fd1196c0 |
line wrap: on
line source
-- Copyright (C) 2009 Florian Zeitz -- -- This file is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- local _G = _G; local prosody = _G.prosody; local st, uuid = require "util.stanza", require "util.uuid"; local adhoc_new = module:require "adhoc".new; function uptime() local t = os.time()-prosody.start_time; local seconds = t%60; t = (t - seconds)/60; local minutes = t%60; t = (t - minutes)/60; 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 "", minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time)); end function uptime_command_handler (item, origin, stanza) origin.send(st.reply(stanza):add_child(item:cmdtag("completed", uuid.generate()):tag("note", {type="info"}):text(uptime()))); return true; end local descriptor = adhoc_new("Get uptime", "uptime", uptime_command_handler); function module.unload() module:remove_item("adhoc", descriptor); end module:add_item ("adhoc", descriptor);