Mercurial > prosody-modules
comparison mod_firewall/actions.lib.lua @ 2542:cca9de97526b
mod_firewall: Fix FORWARD action to include a 'from' address and depend on core_post_stanza
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Feb 2017 22:40:31 +0000 |
parents | 76f03d514b13 |
children | 9392f45b0364 |
comparison
equal
deleted
inserted
replaced
2541:76f03d514b13 | 2542:cca9de97526b |
---|---|
155 return route_modify(("reply(stanza):body(%q)"):format(with)); | 155 return route_modify(("reply(stanza):body(%q)"):format(with)); |
156 end | 156 end |
157 | 157 |
158 function action_handlers.FORWARD(where) | 158 function action_handlers.FORWARD(where) |
159 local code = [[ | 159 local code = [[ |
160 local newstanza = st.stanza("message", { to = %q }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" }); | 160 local newstanza = st.stanza("message", { to = %q, from = session.host }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" }); |
161 local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza); | 161 local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza); |
162 core_post_stanza(session, newstanza); | 162 core_post_stanza(session, newstanza); |
163 ]]; | 163 ]]; |
164 return code:format(where); | 164 return code:format(where), { "core_post_stanza" }; |
165 end | 165 end |
166 | 166 |
167 function action_handlers.LOG(string) | 167 function action_handlers.LOG(string) |
168 local level = string:match("^%[(%a+)%]") or "info"; | 168 local level = string:match("^%[(%a+)%]") or "info"; |
169 string = string:gsub("^%[%a+%] ?", ""); | 169 string = string:gsub("^%[%a+%] ?", ""); |