changeset 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
parents d1bc9a796daf
children e76f7b6be20e
files mod_ipcheck/mod_ipcheck.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
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