Software /
code /
prosody-modules
Changeset
2541:76f03d514b13
mod_firewall: Add FORWARD action (XEP-0297)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Feb 2017 13:37:44 +0000 |
parents | 2540:d637bc0ac604 |
children | 2542:cca9de97526b |
files | mod_firewall/actions.lib.lua |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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+%] ?", "");