2 local st = require "util.stanza"
\r
4 local jid_split = require "util.jid".split;
\r
5 local t_concat = table.concat;
\r
7 local start_time = os.time();
\r
9 require "core.discomanager".set("uptime", "jabber:iq:last");
\r
11 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last",
\r
12 function (origin, stanza)
\r
13 if stanza.tags[1].name == "query" then
\r
14 if stanza.attr.type == "get" then
\r
15 local node, host, resource = jid_split(stanza.attr.to);
\r
16 if node or resource then
\r
19 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));
\r