From d0b6d2010c6badde88a1493ea67fc19d94ccff4c Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Thu, 23 Apr 2020 18:16:36 +0200
Subject: util.rsm: Fix passing number as attribute

---
 util/rsm.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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
-- 
cgit v1.2.3