diff options
Diffstat (limited to 'plugins/mod_scansion_record.lua')
-rw-r--r-- | plugins/mod_scansion_record.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/mod_scansion_record.lua b/plugins/mod_scansion_record.lua index 8d772b4e..5fefd398 100644 --- a/plugins/mod_scansion_record.lua +++ b/plugins/mod_scansion_record.lua @@ -8,7 +8,7 @@ local dt = require "util.datetime"; local dm = require "util.datamanager"; local st = require "util.stanza"; -local record_id = id.medium():lower(); +local record_id = id.short():lower(); local record_date = os.date("%Y%b%d"):lower(); local header_file = dm.getpath(record_id, "scansion", record_date, "scs", true); local record_file = dm.getpath(record_id, "scansion", record_date, "log", true); @@ -18,10 +18,12 @@ local scan = io.open(record_file, "w+"); local function record(string) scan:write(string); + scan:flush(); end local function record_header(string) head:write(string); + head:flush(); end local function record_object(class, name, props) @@ -30,6 +32,7 @@ local function record_object(class, name, props) head:write(("\t%s: %s\n"):format(k, v)); end head:write("\n"); + head:flush(); end local function record_event(session, event) @@ -37,8 +40,7 @@ local function record_event(session, event) end local function record_stanza(stanza, session, verb) - local flattened = tostring(stanza):gsub("><", ">\n\t<"); - -- TODO Proper prettyprinting with indentation + local flattened = tostring(stanza:indent(2, "\t")); record(session.scansion_id.." "..verb..":\n\t"..flattened.."\n\n"); end |