Mercurial > prosody-modules
comparison mod_firewall/actions.lib.lua @ 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 | 9d2bfff515b8 |
| children | cca9de97526b |
comparison
equal
deleted
inserted
replaced
| 2540:d637bc0ac604 | 2541:76f03d514b13 |
|---|---|
| 153 | 153 |
| 154 function action_handlers.REPLY(with) | 154 function action_handlers.REPLY(with) |
| 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) | |
| 159 local code = [[ | |
| 160 local newstanza = st.stanza("message", { to = %q }):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); | |
| 162 core_post_stanza(session, newstanza); | |
| 163 ]]; | |
| 164 return code:format(where); | |
| 165 end | |
| 166 | |
| 158 function action_handlers.LOG(string) | 167 function action_handlers.LOG(string) |
| 159 local level = string:match("^%[(%a+)%]") or "info"; | 168 local level = string:match("^%[(%a+)%]") or "info"; |
| 160 string = string:gsub("^%[%a+%] ?", ""); | 169 string = string:gsub("^%[%a+%] ?", ""); |
| 161 local meta_deps = {}; | 170 local meta_deps = {}; |
| 162 local code = meta(("(session.log or log)(%q, %q);"):format(level, string), meta_deps); | 171 local code = meta(("(session.log or log)(%q, %q);"):format(level, string), meta_deps); |
