Comparison

plugins/mod_uptime.lua @ 10749:abbdf72b0710

mod_uptime: Encode uptime as decimal, fix #1536 (thanks Martin)
author Kim Alvefur <zash@zash.se>
date Wed, 22 Apr 2020 21:46:56 +0200
parent 10565:421b2f8369fd
child 12977:74b9e05af71e
comparison
equal deleted inserted replaced
10748:93293891709b 10749:abbdf72b0710
14 -- XEP-0012: Last activity 14 -- XEP-0012: Last activity
15 module:add_feature("jabber:iq:last"); 15 module:add_feature("jabber:iq:last");
16 16
17 module:hook("iq-get/host/jabber:iq:last:query", function(event) 17 module:hook("iq-get/host/jabber:iq:last:query", function(event)
18 local origin, stanza = event.origin, event.stanza; 18 local origin, stanza = event.origin, event.stanza;
19 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(os.difftime(os.time(), start_time))})); 19 origin.send(st.reply(stanza):tag("query", {xmlns = "jabber:iq:last", seconds = tostring(("%d"):format(os.difftime(os.time(), start_time)))}));
20 return true; 20 return true;
21 end); 21 end);
22 22
23 -- Ad-hoc command 23 -- Ad-hoc command
24 module:depends "adhoc"; 24 module:depends "adhoc";