From b85188f938aa222bb49c85fbb90319fe0ab4ee23 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 12 Nov 2018 16:32:43 +0100 Subject: mod_scansion_record: Discard from/to where these are implicitly the sessions full JID Makes it easier to clean up recordings and change JIDs etc --- plugins/mod_scansion_record.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/mod_scansion_record.lua b/plugins/mod_scansion_record.lua index 3fbc8b6b..0c0e8dbd 100644 --- a/plugins/mod_scansion_record.lua +++ b/plugins/mod_scansion_record.lua @@ -6,6 +6,7 @@ local filters = require "util.filters"; local id = require "util.id"; local dt = require "util.datetime"; local dm = require "util.datamanager"; +local st = require "util.stanza"; local record_id = id.medium():lower(); local record_date = os.date("%Y%b%d"):lower(); @@ -41,7 +42,9 @@ end local function record_stanza_in(stanza, session) if stanza.attr.xmlns == nil then - record_stanza(stanza, session, "sends") + local copy = st.clone(stanza); + copy.attr.from = nil; + record_stanza(copy, session, "sends") end return stanza; end @@ -49,7 +52,11 @@ end local function record_stanza_out(stanza, session) if stanza.attr.xmlns == nil then if not (stanza.name == "iq" and stanza:get_child("bind", "urn:ietf:params:xml:ns:xmpp-bind")) then - record_stanza(stanza, session, "receives"); + local copy = st.clone(stanza); + if copy.attr.to == session.full_jid then + copy.attr.to = nil; + end + record_stanza(copy, session, "receives"); end end return stanza; -- cgit v1.2.3 From e3164afc4a19b3f0d664b7c81bed3bb0e51781cd Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 12 Nov 2018 17:15:41 +0100 Subject: mod_scansion_record: Split stanzas into multiple lines Not perfect but should improve readability somewhat --- plugins/mod_scansion_record.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mod_scansion_record.lua b/plugins/mod_scansion_record.lua index 0c0e8dbd..8d772b4e 100644 --- a/plugins/mod_scansion_record.lua +++ b/plugins/mod_scansion_record.lua @@ -37,7 +37,9 @@ local function record_event(session, event) end local function record_stanza(stanza, session, verb) - record(session.scansion_id.." "..verb..":\n\t"..tostring(stanza).."\n\n"); + local flattened = tostring(stanza):gsub("><", ">\n\t<"); + -- TODO Proper prettyprinting with indentation + record(session.scansion_id.." "..verb..":\n\t"..flattened.."\n\n"); end local function record_stanza_in(stanza, session) -- cgit v1.2.3 From cdf083b8d48516ae3c0e2f25da92eb9479b19012 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 12 Nov 2018 18:25:40 +0100 Subject: MUC: Add scanison test case for #1230 --- spec/scansion/muc_whois_anyone_member.scs | 101 ++++++++++++++++++++++++++++++ spec/scansion/prosody.cfg.lua | 1 + 2 files changed, 102 insertions(+) create mode 100644 spec/scansion/muc_whois_anyone_member.scs diff --git a/spec/scansion/muc_whois_anyone_member.scs b/spec/scansion/muc_whois_anyone_member.scs new file mode 100644 index 00000000..9a6f7e15 --- /dev/null +++ b/spec/scansion/muc_whois_anyone_member.scs @@ -0,0 +1,101 @@ +# MUC: Allow members to fetch the affiliation lists in open non-anonymous rooms + +[Client] Romeo + jid: romeo@localhost/MsliYo9C + password: password + +[Client] Juliet + jid: juliet@localhost/vJrUtY4Z + password: password + +----- + +Romeo connects + +Romeo sends: + + + + +Romeo receives: + + + + + + + + +Romeo receives: + + + + +Romeo sends: + + + + + http://jabber.org/protocol/muc#roomconfig + + + anyone + + + + + +Romeo receives: + + +Romeo receives: + + + + + + +Juliet connects + +Juliet sends: + + + + +Juliet receives: + + + + + + +Juliet receives: + + + + + + + + +Juliet receives: + + + + +Juliet sends: + + + + + + +Juliet receives: + + + + +Juliet disconnects + +Romeo disconnects + diff --git a/spec/scansion/prosody.cfg.lua b/spec/scansion/prosody.cfg.lua index b30d5218..a6e8d289 100644 --- a/spec/scansion/prosody.cfg.lua +++ b/spec/scansion/prosody.cfg.lua @@ -42,6 +42,7 @@ modules_enabled = { --"motd"; -- Send a message to users when they log in --"legacyauth"; -- Legacy authentication. Only used by some old clients and bots. --"proxy65"; -- Enables a file transfer proxy service which clients behind NAT can use + --"scansion_record"; } certificate = "certs" -- cgit v1.2.3