Comparison

plugins/mod_scansion_record.lua @ 9351:b37f131d68c2

mod_scansion_record: Complete stanza recording functions
author Kim Alvefur <zash@zash.se>
date Sat, 22 Sep 2018 13:58:23 +0200
parent 9350:07fd880905a3
child 9352:0fdb70ad9fcc
comparison
equal deleted inserted replaced
9350:07fd880905a3 9351:b37f131d68c2
13 local function record(string) 13 local function record(string)
14 fh:write(string); 14 fh:write(string);
15 end 15 end
16 16
17 local function record_event(session, event) 17 local function record_event(session, event)
18 record(session.scansion_id.." "..event.."\n\n");
18 end 19 end
19 20
20 local function record_stanza(stanza, session, verb) 21 local function record_stanza(stanza, session, verb)
21 record(session.scansion_id.." "..verb..":\n\t"..tostring(stanza).."\n\n"); 22 record(session.scansion_id.." "..verb..":\n\t"..tostring(stanza).."\n\n");
22 end 23 end
23 24
24 local function record_stanza_in(stanza, session) 25 local function record_stanza_in(stanza, session)
26 record_stanza(stanza, session, "sends")
27 return stanza;
25 end 28 end
26 29
27 local function record_stanza_out(stanza, session) 30 local function record_stanza_out(stanza, session)
31 record_stanza(stanza, session, "receives")
32 return stanza;
28 end 33 end
29 34
30 module:hook("resource-bind", function (event) 35 module:hook("resource-bind", function (event)
31 local session = event.session; 36 local session = event.session;
32 if not users[session.username] then 37 if not users[session.username] then