Software /
code /
prosody
Comparison
plugins/mod_carbons.lua @ 8354:b41947a0fc0c
mod_carbons: Synthesize a 'to' attribute for carbons of stanzas to "self" (fixes #956)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 26 Oct 2017 22:22:14 +0200 |
parent | 7776:63f50a84318f |
child | 10469:658b759a1f7a |
child | 10777:3695904d2854 |
comparison
equal
deleted
inserted
replaced
8353:aa6497031924 | 8354:b41947a0fc0c |
---|---|
74 return | 74 return |
75 end | 75 end |
76 | 76 |
77 -- Create the carbon copy and wrap it as per the Stanza Forwarding XEP | 77 -- Create the carbon copy and wrap it as per the Stanza Forwarding XEP |
78 local copy = st.clone(stanza); | 78 local copy = st.clone(stanza); |
79 if c2s and not orig_to then | |
80 stanza.attr.to = bare_from; | |
81 end | |
79 copy.attr.xmlns = "jabber:client"; | 82 copy.attr.xmlns = "jabber:client"; |
80 local carbon = st.message{ from = bare_jid, type = orig_type, } | 83 local carbon = st.message{ from = bare_jid, type = orig_type, } |
81 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }) | 84 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }) |
82 :tag("forwarded", { xmlns = xmlns_forward }) | 85 :tag("forwarded", { xmlns = xmlns_forward }) |
83 :add_child(copy):reset(); | 86 :add_child(copy):reset(); |