diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-22 14:36:34 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-22 14:36:34 +0200 |
commit | 0c533092dda5531483033bab8bed0ab960dd9775 (patch) | |
tree | 5a19219b92877c8c6e2bfb23f0da2af2c681177e /plugins | |
parent | cf746b62d60b873ea03293a96e98915b17814413 (diff) | |
download | prosody-0c533092dda5531483033bab8bed0ab960dd9775.tar.gz prosody-0c533092dda5531483033bab8bed0ab960dd9775.zip |
mod_scansion_record: Open a related file for header entries
Since It's tricky to go back and insert data at the beginning of a file,
but `cat blah.sch blah.scs` ought to be fine for now.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_scansion_record.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_scansion_record.lua b/plugins/mod_scansion_record.lua index e7fa8e70..6e93aead 100644 --- a/plugins/mod_scansion_record.lua +++ b/plugins/mod_scansion_record.lua @@ -10,14 +10,20 @@ local dm = require "util.datamanager"; local record_id = id.medium():lower(); local record_date = os.date("%Y%b%d"):lower(); +local header_file = dm.getpath(record_id, "scansion", record_date, "sch", true); local record_file = dm.getpath(record_id, "scansion", record_date, "scs", true); +local head = io.open(header_file, "w"); local scan = io.open(record_file, "w"); local function record(string) scan:write(string); end +local function record_header(string) + head:write(string); +end + local function record_event(session, event) record(session.scansion_id.." "..event.."\n\n"); end @@ -74,4 +80,5 @@ end); module:hook_global("server-stopping", function () module:log("info", "Scansion recording available in %s", record_file); scan:close(); + head:close() end); |