IMPORTANT: due to a drive failure, as of 13-Mar-2021, the Mercurial repository had to be re-mirrored, which changed every commit SHA. The old SHAs and trees are backed up in the vault branches. Please migrate to the new branches as soon as you can.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
prosody/plugins/mod_uptime.lua

24 lines
682 B

local st = require "util.stanza"
local jid_split = require "util.jid".split;
local t_concat = table.concat;
local start_time = os.time();
require "core.discomanager".set("uptime", "jabber:iq:last");
module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last",
function (origin, stanza)
if stanza.tags[1].name == "query" then
if stanza.attr.type == "get" then
local node, host, resource = jid_split(stanza.attr.to);
if node or resource then
-- TODO
else
origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));
return true;
end
end
end
end);