Comparison

mod_firewall/actions.lib.lua @ 5889:bfc35ae9edcb

mod_firewall: 'REPORT TO': fix default reason fallback if none is provided
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Mar 2024 14:27:43 +0000
parent 5540:1249ab2f797c
child 5891:3f5644aa5c32
comparison
equal deleted inserted replaced
5888:b5a110544fd4 5889:bfc35ae9edcb
261 261
262 function action_handlers.REPORT_TO(spec) 262 function action_handlers.REPORT_TO(spec)
263 local where, reason, text = spec:match("^%s*(%S+) *(%S*) *(.*)$"); 263 local where, reason, text = spec:match("^%s*(%S+) *(%S*) *(.*)$");
264 if reason == "spam" then 264 if reason == "spam" then
265 reason = "urn:xmpp:reporting:spam"; 265 reason = "urn:xmpp:reporting:spam";
266 elseif reason == "abuse" or not reason then 266 elseif reason == "abuse" or not reason or reason = "" then
267 reason = "urn:xmpp:reporting:abuse"; 267 reason = "urn:xmpp:reporting:abuse";
268 end 268 end
269 local code = [[ 269 local code = [[
270 local newstanza = st.stanza("message", { to = %q, from = current_host }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" }); 270 local newstanza = st.stanza("message", { to = %q, from = current_host }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" });
271 local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza):up(); 271 local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza):up();