Software /
code /
prosody
Comparison
plugins/mod_scansion_record.lua @ 9619:7172077c0a53 0.11
mod_scansion_record: Split stanzas into multiple lines
Not perfect but should improve readability somewhat
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 12 Nov 2018 17:15:41 +0100 |
parent | 9618:d6e6e1fb7ef0 |
child | 10718:d229e4d31598 |
comparison
equal
deleted
inserted
replaced
9618:d6e6e1fb7ef0 | 9619:7172077c0a53 |
---|---|
35 local function record_event(session, event) | 35 local function record_event(session, event) |
36 record(session.scansion_id.." "..event.."\n\n"); | 36 record(session.scansion_id.." "..event.."\n\n"); |
37 end | 37 end |
38 | 38 |
39 local function record_stanza(stanza, session, verb) | 39 local function record_stanza(stanza, session, verb) |
40 record(session.scansion_id.." "..verb..":\n\t"..tostring(stanza).."\n\n"); | 40 local flattened = tostring(stanza):gsub("><", ">\n\t<"); |
41 -- TODO Proper prettyprinting with indentation | |
42 record(session.scansion_id.." "..verb..":\n\t"..flattened.."\n\n"); | |
41 end | 43 end |
42 | 44 |
43 local function record_stanza_in(stanza, session) | 45 local function record_stanza_in(stanza, session) |
44 if stanza.attr.xmlns == nil then | 46 if stanza.attr.xmlns == nil then |
45 local copy = st.clone(stanza); | 47 local copy = st.clone(stanza); |