# HG changeset patch # User Kim Alvefur # Date 1330436015 -3600 # Node ID 26754852281067dc820a401070a4e16900450947 # Parent 3ca933c9d8ffe215dec1806e7dc18139a5662b3a mod_carbons: Remove useless protection against loop that can't happen diff -r 3ca933c9d8ff -r 267548522810 mod_carbons/mod_carbons.lua --- a/mod_carbons/mod_carbons.lua Tue Feb 28 14:20:43 2012 +0100 +++ b/mod_carbons/mod_carbons.lua Tue Feb 28 14:33:35 2012 +0100 @@ -80,31 +80,29 @@ return end - if not stanza:get_child("forwarded", xmlns_forward) then - user_sessions = user_sessions and user_sessions.sessions; - for resource, session in pairs(user_sessions) do - local full_jid = bare_jid .. "/" .. resource; - module:log("debug", "%s wants carbons: %s", session.full_jid, tostring(session.want_carbons)); - if session.want_carbons then - if c2s then - module:log("debug", "Session is origin: %s", tostring(session == origin)); - else - module:log("debug", "Session is in ignore list: %s", tostring(no_carbon_to[resource])); - end - if (c2s and session ~= origin) or (not c2s and not no_carbon_to[resource]) then - local msg = st.clone(stanza); - msg.attr.xmlns = msg.attr.xmlns or "jabber:client"; - local fwd = st.message{ - from = bare_jid, - to = full_jid, - type = orig_type, - } - :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }):up() - :tag("forwarded", { xmlns = xmlns_forward }) - :add_child(msg); - module:log("debug", "Sending carbon"); - session.send(fwd); - end + user_sessions = user_sessions and user_sessions.sessions; + for resource, session in pairs(user_sessions) do + local full_jid = bare_jid .. "/" .. resource; + module:log("debug", "%s wants carbons: %s", session.full_jid, tostring(session.want_carbons)); + if session.want_carbons then + if c2s then + module:log("debug", "Session is origin: %s", tostring(session == origin)); + else + module:log("debug", "Session is in ignore list: %s", tostring(no_carbon_to[resource])); + end + if (c2s and session ~= origin) or (not c2s and not no_carbon_to[resource]) then + local msg = st.clone(stanza); + msg.attr.xmlns = msg.attr.xmlns or "jabber:client"; + local fwd = st.message{ + from = bare_jid, + to = full_jid, + type = orig_type, + } + :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }):up() + :tag("forwarded", { xmlns = xmlns_forward }) + :add_child(msg); + module:log("debug", "Sending carbon"); + session.send(fwd); end end end