aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-10-25 21:43:23 +0200
committerKim Alvefur <zash@zash.se>2021-10-25 21:43:23 +0200
commit20543ca56ed6d66f98605f67bd41657e05bf74f8 (patch)
tree855bafd3253864dab3dcf84322c3e4573b77a1e5
parent38722376258e3a2888326fdc05132050dca2b25c (diff)
downloadprosody-20543ca56ed6d66f98605f67bd41657e05bf74f8.tar.gz
prosody-20543ca56ed6d66f98605f67bd41657e05bf74f8.zip
mod_admin_adhoc: Move number coercion into util.dataforms
Internal use of XEP-0122 to shift the responsibility for converting numbers to strings.
-rw-r--r--plugins/mod_admin_adhoc.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua
index 1471fba0..d0b0d452 100644
--- a/plugins/mod_admin_adhoc.lua
+++ b/plugins/mod_admin_adhoc.lua
@@ -254,7 +254,7 @@ local get_user_stats_layout = dataforms_new{
local get_user_stats_result_layout = dataforms_new{
{ name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" };
{ name = "ipaddresses", type = "text-multi", label = "IP Addresses" };
- { name = "rostersize", type = "text-single", label = "Roster size" };
+ { name = "rostersize", type = "text-single", label = "Roster size", datatype = "xs:integer" };
{ name = "onlineresources", type = "text-multi", label = "Online Resources" };
};
@@ -282,7 +282,7 @@ local get_user_stats_handler = adhoc_simple(get_user_stats_layout, function(fiel
resources = resources .. "\n" .. resource;
IPs = IPs .. "\n" .. session.ip;
end
- return { status = "completed", result = {layout = get_user_stats_result_layout, values = {ipaddresses = IPs, rostersize = tostring(rostersize),
+ return { status = "completed", result = {layout = get_user_stats_result_layout, values = {ipaddresses = IPs, rostersize = rostersize,
onlineresources = resources}} };
end);
@@ -341,10 +341,10 @@ end);
local list_s2s_this_result = dataforms_new {
title = "List of S2S connections on this host";
- { name = "FORM_TYPE", type = "hidden", value = "http://prosody.im/protocol/s2s#list" };
- { name = "sessions", type = "text-multi", label = "Connections:" };
- { name = "num_in", type = "text-single", label = "#incoming connections:" };
- { name = "num_out", type = "text-single", label = "#outgoing connections:" };
+ { name = "FORM_TYPE"; type = "hidden"; value = "http://prosody.im/protocol/s2s#list" };
+ { name = "sessions"; type = "text-multi"; label = "Connections:" };
+ { name = "num_in"; type = "text-single"; label = "#incoming connections:"; datatype = "xs:integer" };
+ { name = "num_out"; type = "text-single"; label = "#outgoing connections:"; datatype = "xs:integer" };
};
local function session_flags(session, line)
@@ -423,8 +423,8 @@ local function list_s2s_this_handler(self, data, state)
return { status = "completed", result = { layout = list_s2s_this_result; values = {
sessions = t_concat(s2s_list, "\n"),
- num_in = tostring(count_in),
- num_out = tostring(count_out)
+ num_in = count_in,
+ num_out = count_out
} } };
end