aboutsummaryrefslogtreecommitdiffstats
path: root/util/rsm.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-04-23 18:16:36 +0200
committerKim Alvefur <zash@zash.se>2020-04-23 18:16:36 +0200
commit93535db346af6b10a1778f91235b7a9429e6ead0 (patch)
treecf35a00974a297951aa5c9db8694084602647b1f /util/rsm.lua
parentda2a13287ee51d1dc1e1db92c3972c72b5d40081 (diff)
downloadprosody-93535db346af6b10a1778f91235b7a9429e6ead0.tar.gz
prosody-93535db346af6b10a1778f91235b7a9429e6ead0.zip
util.rsm: Fix passing number as attribute
Diffstat (limited to 'util/rsm.lua')
-rw-r--r--util/rsm.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/rsm.lua b/util/rsm.lua
index 40a78fb5..b5afd62a 100644
--- a/util/rsm.lua
+++ b/util/rsm.lua
@@ -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 @@ end
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