Diff

plugins/mod_dialback.lua @ 4835:751510cd558d

mod_dialback: COMPAT reset session.send function for servers (e.g. ejabberd) which don't include a from attr when opening the stream.
author Marco Cirillo <maranda@lightwitch.org>
date Wed, 09 May 2012 02:56:22 +0000
parent 4761:178f252c31b0
child 4836:bda0593d3f73
child 4840:82679fad3a36
line wrap: on
line diff
--- a/plugins/mod_dialback.lua	Fri May 04 02:28:10 2012 +0100
+++ b/plugins/mod_dialback.lua	Wed May 09 02:56:22 2012 +0000
@@ -78,6 +78,9 @@
 		if not origin.from_host then
 			-- Just used for friendlier logging
 			origin.from_host = attr.from;
+			-- COMPAT: Fix ejabberd chopness by resetting the send function
+			origin.log("debug", "Remote server didn't specify a from attr, resetting session.send now that we know where to knock to.");
+			origin.send = function(stanza) hosts[attr.to].events.fire_event("route/remote", { from_host = origin.to_host, to_host = origin.from_host, stanza = stanza}); end
 		end
 		if not origin.to_host then
 			-- Just used for friendlier logging