# HG changeset patch # User Kim Alvefur # Date 1542036763 -3600 # Node ID d6e6e1fb7ef0e23e9041c326bdeb190641f926b7 # Parent 61376a3c0c1d1b2c5851f3f24f538463a4bc47a0 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 diff -r 61376a3c0c1d -r d6e6e1fb7ef0 plugins/mod_scansion_record.lua --- a/plugins/mod_scansion_record.lua Sun Nov 11 02:26:40 2018 +0100 +++ b/plugins/mod_scansion_record.lua Mon Nov 12 16:32:43 2018 +0100 @@ -6,6 +6,7 @@ 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 @@ 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 @@ 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;