Mercurial > prosody-modules
comparison mod_firewall/actions.lib.lua @ 2086:de6b95d5e01b
mod_firewall: tostring() the results of meta expressions
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 16 Mar 2016 11:09:46 +0000 |
parents | 2356114ff505 |
children | a1e9ca4cb181 |
comparison
equal
deleted
inserted
replaced
2085:8cb8004091f8 | 2086:de6b95d5e01b |
---|---|
1 local action_handlers = {}; | 1 local action_handlers = {}; |
2 | 2 |
3 | 3 |
4 -- Run code through this to allow strings to contain code. e.g.: LOG=Received: $(stanza:top_tag()) | 4 -- Run code through this to allow strings to contain code. e.g.: LOG=Received: $(stanza:top_tag()) |
5 local function meta(s, extra) | 5 local function meta(s, extra) |
6 return (s:gsub("$(%b())", [["..%1.."]]) | 6 return (s:gsub("$(%b())", [["..tostring(%1).."]]) |
7 :gsub("$(%b<>)", [["..stanza:find("%1").."]]) | 7 :gsub("$(%b<>)", [["..stanza:find("%1").."]]) |
8 :gsub("$$(%a+)", extra or {})); | 8 :gsub("$$(%a+)", extra or {})); |
9 end | 9 end |
10 | 10 |
11 -- Takes an XML string and returns a code string that builds that stanza | 11 -- Takes an XML string and returns a code string that builds that stanza |