diff options
author | Kim Alvefur <zash@zash.se> | 2018-11-12 16:32:43 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-11-12 16:32:43 +0100 |
commit | b85188f938aa222bb49c85fbb90319fe0ab4ee23 (patch) | |
tree | 9a562a2cc5e2f6f033005688471d699fe9dd5f61 /plugins/mod_scansion_record.lua | |
parent | 1086a1325d81d6cc6a49d2bf2e6bc81e984a2bd0 (diff) | |
download | prosody-b85188f938aa222bb49c85fbb90319fe0ab4ee23.tar.gz prosody-b85188f938aa222bb49c85fbb90319fe0ab4ee23.zip |
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
Diffstat (limited to 'plugins/mod_scansion_record.lua')
-rw-r--r-- | plugins/mod_scansion_record.lua | 11 |
1 files 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; |