2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 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 start_time = prosody.start_time;
12 prosody.events.add_handler("server-started", function() start_time = prosody.start_time end);
14 module:add_feature("jabber:iq:last");
16 module:hook("iq/host/jabber:iq:last:query", function(event)
17 local origin, stanza = event.origin, event.stanza;
18 if stanza.attr.type == "get" then
19 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))}));