Software /
code /
prosody
Changeset
10750:ff087f2d4cb6
mod_lastactivity: Encode seconds as decimal, not float
In Lua 5.3 difftime() takes integers as argument but returns a float,
and then tostring() serializes it with a decimal point. This violates
XEP-0012.
Like #1536
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 22 Apr 2020 23:36:25 +0200 |
parents | 10749:abbdf72b0710 |
children | 10751:4db4bd8a7822 |
files | plugins/mod_lastactivity.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_lastactivity.lua Wed Apr 22 21:46:56 2020 +0200 +++ b/plugins/mod_lastactivity.lua Wed Apr 22 23:36:25 2020 +0200 @@ -30,7 +30,7 @@ if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then local seconds, text = "0", ""; if map[username] then - seconds = tostring(os.difftime(os.time(), map[username].t)); + seconds = string.format("%d", os.difftime(os.time(), map[username].t)); text = map[username].s; end origin.send(st.reply(stanza):tag('query', {xmlns='jabber:iq:last', seconds=seconds}):text(text));