Software /
code /
prosody
Diff
util/rsm.lua @ 10761:b53193bb21cc
util.rsm: Fix passing number as attribute
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 23 Apr 2020 18:16:36 +0200 |
parent | 7852:e594010e1ba0 |
child | 10763:e0e2ae050d65 |
line wrap: on
line diff
--- a/util/rsm.lua Thu Apr 23 18:05:00 2020 +0200 +++ b/util/rsm.lua Thu Apr 23 18:16:36 2020 +0200 @@ -11,9 +11,14 @@ local stanza = require"util.stanza".stanza; local tostring, tonumber = tostring, tonumber; +local s_format = string.format; local type = type; local pairs = pairs; +local function inttostr(n) + return s_format("%d", n); +end + local xmlns_rsm = 'http://jabber.org/protocol/rsm'; local element_parsers = {}; @@ -45,7 +50,7 @@ local element_generators = setmetatable({ first = function(st, data) if type(data) == "table" then - st:tag("first", { index = data.index }):text(data[1]):up(); + st:tag("first", { index = inttostr(data.index) }):text(data[1]):up(); else st:tag("first"):text(tostring(data)):up(); end