# HG changeset patch # User Matthew Wild # Date 1487684264 0 # Node ID 76f03d514b133b4f7848ae83d6a42769361c2b00 # Parent d637bc0ac604ea70dde0bfc5931dd4b26ec163eb mod_firewall: Add FORWARD action (XEP-0297) diff -r d637bc0ac604 -r 76f03d514b13 mod_firewall/actions.lib.lua --- a/mod_firewall/actions.lib.lua Tue Feb 21 10:39:00 2017 +0000 +++ b/mod_firewall/actions.lib.lua Tue Feb 21 13:37:44 2017 +0000 @@ -155,6 +155,15 @@ return route_modify(("reply(stanza):body(%q)"):format(with)); end +function action_handlers.FORWARD(where) + local code = [[ + local newstanza = st.stanza("message", { to = %q }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" }); + local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza); + core_post_stanza(session, newstanza); + ]]; + return code:format(where); +end + function action_handlers.LOG(string) local level = string:match("^%[(%a+)%]") or "info"; string = string:gsub("^%[%a+%] ?", "");