Changeset

10355:cb9755d7a36e

MUC: Advertise history related fields as integers via XEP-0122 This takes advantage of data type validation and conversion done in util.dataforms.
author Kim Alvefur <zash@zash.se>
date Sun, 20 Oct 2019 23:47:48 +0200
parents 10354:8a186801257b
children 10356:0a2d7efca039
files plugins/muc/history.lib.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/history.lib.lua	Sun Oct 20 23:46:47 2019 +0200
+++ b/plugins/muc/history.lib.lua	Sun Oct 20 23:47:48 2019 +0200
@@ -48,16 +48,18 @@
 	table.insert(event.form, {
 		name = "muc#roomconfig_historylength";
 		type = "text-single";
+		datatype = "xs:integer";
 		label = "Maximum number of history messages returned by room";
 		desc = "Specify the maximum number of previous messages that should be sent to users when they join the room";
-		value = tostring(get_historylength(event.room));
+		value = get_historylength(event.room);
 	});
 	table.insert(event.form, {
 		name = 'muc#roomconfig_defaulthistorymessages',
 		type = 'text-single',
+		datatype = "xs:integer";
 		label = 'Default number of history messages returned by room',
 		desc = "Specify the number of previous messages sent to new users when they join the room";
-		value = tostring(get_defaulthistorymessages(event.room))
+		value = get_defaulthistorymessages(event.room);
 	});
 end, 70-5);