Mercurial > prosody-modules
diff mod_carbons/mod_carbons.lua @ 836:a86131581180
mod_carbons: Less complicated assignments (thanks waqas)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 22 Sep 2012 01:56:59 +0200 |
parents | 07cc1efde2f8 |
children | 0ef11dee7050 |
line wrap: on
line diff
--- a/mod_carbons/mod_carbons.lua Wed Sep 19 16:36:32 2012 +0200 +++ b/mod_carbons/mod_carbons.lua Sat Sep 22 01:56:59 2012 +0200 @@ -7,7 +7,6 @@ local jid_bare = require "util.jid".bare; local xmlns_carbons = "urn:xmpp:carbons:1"; local xmlns_forward = "urn:xmpp:forward:0"; -local host_sessions = hosts[module.host].sessions; local full_sessions, bare_sessions = full_sessions, bare_sessions; local function toggle_carbons(event) @@ -36,15 +35,15 @@ end -- Stanza sent by a local client - local bare_jid = origin.type == "c2s" and origin.username .. "@" .. origin.host or jid_bare(orig_from); + local bare_jid = jid_bare(orig_from); local target_session = origin; local top_priority = false; - local user_sessions = host_sessions[origin.username]; + local user_sessions = bare_sessions[bare_jid]; -- Stanza about to be delivered to a local client if not c2s then bare_jid = jid_bare(orig_to); - target_session = full_sessions[orig_to] + target_session = full_sessions[orig_to]; user_sessions = bare_sessions[bare_jid]; if not target_session and user_sessions then -- The top resources will already receive this message per normal routing rules,