Software /
code /
prosody-modules
Changeset
966:a65df6e97d94
mod_firewall: Add time and date deps
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 06 Apr 2013 14:02:38 +0100 |
parents | 965:d4e24fb289c0 |
children | 967:a88f33fe6970 |
files | mod_firewall/mod_firewall.lua |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua Fri Apr 05 19:21:46 2013 +0100 +++ b/mod_firewall/mod_firewall.lua Sat Apr 06 14:02:38 2013 +0100 @@ -76,6 +76,14 @@ assert(zone:match("^%a[%w_]*$"), "Invalid zone name: "..zone); return ("local zone_%s = zones[%q] or {};"):format(zone, zone); end }; + date_time = { global_code = [[local os_date = os.date]]; local_code = [[local current_date_time = os_date("*t");]] }; + time = { local_code = function (what) + local defs = {}; + for field in what:gmatch("%a+") do + table.insert(defs, ("local current_%s = current_date_time.%s;"):format(field, field)); + end + return table.concat(defs, " "); + end, depends = { "date_time" }; }; }; local function include_dep(dep, code)