Diff

mod_ipcheck/mod_ipcheck.lua @ 1245:a1287d1f8a1f

mod_ipcheck: Workaround for differences between server_select and server_event
author Kim Alvefur <zash@zash.se>
date Wed, 04 Dec 2013 19:26:37 +0100
parent 1244:d1bc9a796daf
child 1945:e5039f14e2a7
line wrap: on
line diff
--- a/mod_ipcheck/mod_ipcheck.lua	Wed Dec 04 17:37:32 2013 +0100
+++ b/mod_ipcheck/mod_ipcheck.lua	Wed Dec 04 19:26:37 2013 +0100
@@ -31,8 +31,10 @@
 		elseif origin.ip then
 			local reply = st.reply(stanza):tag("address", {xmlns='urn:xmpp:sic:0'})
 				:tag("ip"):text(origin.ip):up()
-			if origin.conn and origin.conn.port then
+			if origin.conn and origin.conn.port then -- server_event
 				reply:tag("port"):text(tostring(origin.conn:port()))
+			elseif origin.conn and origin.conn.clientport then -- server_select
+				reply:tag("port"):text(tostring(origin.conn:clientport()))
 			end
 			origin.send(reply);
 		else