stanza_router: A little refactoring

Sat, 20 Jun 2009 17:51:00 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sat, 20 Jun 2009 17:51:00 +0500
changeset 1367
e4d660e58dfc
parent 1366
54b5121b6c83
child 1368
0cb70958b8fb

stanza_router: A little refactoring

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Sat Jun 20 14:38:22 2009 +0500
+++ b/core/stanza_router.lua	Sat Jun 20 17:51:00 2009 +0500
@@ -48,15 +48,15 @@
 		end
 	end
 
-	if origin.type == "c2s" and not origin.full_jid
-		and not(stanza.name == "iq" and stanza.attr.type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind"
-				and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
-		-- authenticated client isn't bound and current stanza is not a bind request
-		origin.send(st.error_reply(stanza, "auth", "not-authorized")); -- FIXME maybe allow stanzas to account or server
-	end
+	if origin.type == "c2s" then
+		if not origin.full_jid
+			and not(stanza.name == "iq" and stanza.attr.type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind"
+					and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
+			-- authenticated client isn't bound and current stanza is not a bind request
+			origin.send(st.error_reply(stanza, "auth", "not-authorized")); -- FIXME maybe allow stanzas to account or server
+		end
 
-	-- TODO also, stanzas should be returned to their original state before the function ends
-	if origin.type == "c2s" then
+		-- TODO also, stanzas should be returned to their original state before the function ends
 		stanza.attr.from = origin.full_jid;
 	end
 	local to, xmlns = stanza.attr.to, stanza.attr.xmlns;

mercurial