Comparison

mod_firewall/actions.lib.lua @ 5891:3f5644aa5c32

mod_firewall: REPORT TO: Include id in reports
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Mar 2024 14:31:45 +0000
parent 5889:bfc35ae9edcb
child 5894:1ac4a59ac575
comparison
equal deleted inserted replaced
5890:1d1eadff331d 5891:3f5644aa5c32
265 reason = "urn:xmpp:reporting:spam"; 265 reason = "urn:xmpp:reporting:spam";
266 elseif reason == "abuse" or not reason or 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, id = new_short_id() }):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();
272 newstanza:tag("report", { xmlns = "urn:xmpp:reporting:1", reason = %q }) 272 newstanza:tag("report", { xmlns = "urn:xmpp:reporting:1", reason = %q })
273 do local text = %q; if text ~= "" then newstanza:text_tag("text", text); end end 273 do local text = %q; if text ~= "" then newstanza:text_tag("text", text); end end
274 newstanza:up(); 274 newstanza:up();
275 core_post_stanza(session, newstanza); 275 core_post_stanza(session, newstanza);
276 ]]; 276 ]];
277 return code:format(where, reason, text), { "core_post_stanza", "current_host", "st" }; 277 return code:format(where, reason, text), { "core_post_stanza", "current_host", "st", "new_short_id" };
278 end 278 end
279 279
280 return action_handlers; 280 return action_handlers;