diff mod_carbons/mod_carbons.lua @ 463:7d6a05f94941

mod_carbons: Fix top_resources loop and correctly stamp sent messages (thanks xnyhps)
author Kim Alvefur <zash@zash.se>
date Sun, 30 Oct 2011 01:41:33 +0200
parents f28a3f260fc2
children 0cef5be669de
line wrap: on
line diff
--- a/mod_carbons/mod_carbons.lua	Sat Oct 29 19:59:48 2011 +0200
+++ b/mod_carbons/mod_carbons.lua	Sun Oct 30 01:41:33 2011 +0200
@@ -61,7 +61,7 @@
 							type = orig_type,
 						}
 					:tag("forwarded", { xmlns = xmlns_forward })
-						:tag("received", { xmlns = xmlns_carbons }):up()
+						:tag("sent", { xmlns = xmlns_carbons }):up()
 							:add_child(msg);
 				core_route_stanza(origin, fwd);
 			end
@@ -92,8 +92,9 @@
 		no_carbon_to[resource] = true;
 	else
 		local top_resources = user_sessions.top_resources;
-		for i=1,top_resources do
-			no_carbon_to[top_resources[i]] = true;
+		for i, session in ipairs(top_resources) do
+			no_carbon_to[session.resource] = true;
+			module:log("debug", "not going to send to /%s", resource);
 		end
 	end
 
@@ -123,7 +124,7 @@
 module:hook("pre-message/bare", c2s_message_handler, 1);
 module:hook("pre-message/full", c2s_message_handler, 1);
 -- Stanszas to local clients
-module:hook("message/bare", s2c_message_handler, 1); -- this will suck
+module:hook("message/bare", s2c_message_handler, 1);
 module:hook("message/full", s2c_message_handler, 1);
 
 module:add_feature(xmlns_carbons);