# HG changeset patch # User Kim Alvefur # Date 1538564344 -7200 # Node ID 4a12abccdbaf6f2b58d8db682e555048fabc14c0 # Parent 0ce475235ae16baa7e6ec21a42cb78161362c82c mod_pastebin: Advertise a disco feature and current thresholds diff -r 0ce475235ae1 -r 4a12abccdbaf mod_pastebin/mod_pastebin.lua --- a/mod_pastebin/mod_pastebin.lua Tue Oct 02 16:09:17 2018 +0100 +++ b/mod_pastebin/mod_pastebin.lua Wed Oct 03 12:59:04 2018 +0200 @@ -152,6 +152,15 @@ module:hook("message/full", check_message); end +module:hook("muc-disco#info", function (event) + local reply, form, formdata = event.reply, event.form, event.formdata; + reply:tag("feature", { var = "https://modules.prosody.im/mod_pastebin" }):up(); + table.insert(form, { name = "https://modules.prosody.im/mod_pastebin#max_lines", datatype = "xs:integer" }); + table.insert(form, { name = "https://modules.prosody.im/mod_pastebin#max_characters", datatype = "xs:integer" }); + formdata["https://modules.prosody.im/mod_pastebin#max_lines"] = line_threshold; + formdata["https://modules.prosody.im/mod_pastebin#max_characters"] = length_threshold; +end); + function expire_pastes(time) time = time or os_time(); -- COMPAT with 0.5 if pastes[1] then