comparison plugins/mod_carbons.lua @ 14184:d79ef7a38fe8 13.0

mod_carbons: Fix 'to' attribute of stanzas to own account This code intended to clarify the 'to' address on the forwarded stanza, however it updated the original stanza instead of the clone.
author Matthew Wild <mwild1@gmail.com>
date Mon, 25 May 2026 16:20:02 +0100
parents d7f2ffc25273
children d975d280baec
comparison
equal deleted inserted replaced
14183:888d0c52db41 14184:d79ef7a38fe8
139 and (c2s or session.priority ~= top_priority) then 139 and (c2s or session.priority ~= top_priority) then
140 if not carbon then 140 if not carbon then
141 -- Create the carbon copy and wrap it as per the Stanza Forwarding XEP 141 -- Create the carbon copy and wrap it as per the Stanza Forwarding XEP
142 local copy = st.clone(stanza); 142 local copy = st.clone(stanza);
143 if c2s and not orig_to then 143 if c2s and not orig_to then
144 stanza.attr.to = bare_from; 144 copy.attr.to = bare_from;
145 end 145 end
146 copy.attr.xmlns = "jabber:client"; 146 copy.attr.xmlns = "jabber:client";
147 carbon = st.message{ from = bare_jid, type = orig_type, } 147 carbon = st.message{ from = bare_jid, type = orig_type, }
148 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }) 148 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons })
149 :tag("forwarded", { xmlns = xmlns_forward }) 149 :tag("forwarded", { xmlns = xmlns_forward })