2 -- Copyright (C) 2008-2009 Matthew Wild
3 -- Copyright (C) 2008-2009 Waqas Hussain
5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information.
11 local st = require "util.stanza"
\r
13 local jid_split = require "util.jid".split;
\r
14 local t_concat = table.concat;
\r
16 local start_time = os.time();
\r
18 module:add_feature("jabber:iq:last");
\r
20 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last",
\r
21 function (origin, stanza)
\r
22 if stanza.tags[1].name == "query" then
\r
23 if stanza.attr.type == "get" then
\r
24 local node, host, resource = jid_split(stanza.attr.to);
\r
25 if node or resource then
\r
28 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));
\r