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.
9 local st = require "util.stanza"
11 local jid_split = require "util.jid".split;
12 local t_concat = table.concat;
14 local start_time = prosody.start_time;
15 prosody.events.add_handler("server-started", function() start_time = prosody.start_time end);
17 module:add_feature("jabber:iq:last");
19 module:hook("iq/host/jabber:iq:last:query", function(event)
20 local origin, stanza = event.origin, event.stanza;
21 if stanza.attr.type == "get" then
22 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));
27 module:hook("iq/bare/jabber:iq:last:query", function(event)
28 local origin, stanza = event.origin, event.stanza;
29 if stanza.attr.type == "get" then