changeset 835:07cc1efde2f8

mod_carbons: Fix handling of messages from remote hosts
author Kim Alvefur <zash@zash.se>
date Wed, 19 Sep 2012 16:36:32 +0200
parents 21e99dc949ee
children a86131581180
files mod_carbons/mod_carbons.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_carbons/mod_carbons.lua	Wed Sep 19 01:30:58 2012 +0000
+++ b/mod_carbons/mod_carbons.lua	Wed Sep 19 16:36:32 2012 +0200
@@ -26,6 +26,7 @@
 local function message_handler(event, c2s)
 	local origin, stanza = event.origin, event.stanza;
 	local orig_type = stanza.attr.type;
+	local orig_from = stanza.attr.from;
 	local orig_to = stanza.attr.to;
 	
 	if not (orig_type == nil
@@ -35,7 +36,7 @@
 	end
 
 	-- Stanza sent by a local client
-	local bare_jid = origin.username .. "@" .. origin.host;
+	local bare_jid = origin.type == "c2s" and origin.username .. "@" .. origin.host or jid_bare(orig_from);
 	local target_session = origin;
 	local top_priority = false;
 	local user_sessions = host_sessions[origin.username];