stanza_router: Replace xmlns == nil checks with 'not xmlns'

Wed, 05 Jan 2011 03:05:13 +0000

author
daurnimator <quae@daurnimator.com>
date
Wed, 05 Jan 2011 03:05:13 +0000
changeset 3998
13a5a8df7c34
parent 3997
ed70d20fc133
child 3999
257d13734d32

stanza_router: Replace xmlns == nil checks with 'not xmlns'

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Wed Jan 05 03:03:40 2011 +0000
+++ b/core/stanza_router.lua	Wed Jan 05 03:05:13 2011 +0000
@@ -29,7 +29,7 @@
 			return true;
 		end
 	end
-	if stanza.attr.xmlns == nil then
+	if not stanza.attr.xmlns then
 		log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it
 		if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
 			origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
@@ -109,7 +109,7 @@
 		return; -- FIXME what should we do here?
 	end]] -- FIXME
 
-	if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and xmlns == nil then
+	if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and not xmlns then
 		if origin.type == "s2sin" and not origin.dummy then
 			local host_status = origin.hosts[from_host];
 			if not host_status or not host_status.authed then -- remote server trying to impersonate some other server?
@@ -122,7 +122,7 @@
 		local h = hosts[stanza.attr.to or origin.host or origin.to_host];
 		if h then
 			local event;
-			if xmlns == nil then
+			if not xmlns then
 				if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") then
 					event = "stanza/iq/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name;
 				else

mercurial