Only reply with errors if the stanza is not an error or a result (don't know how much bandwidth this just cost me :) )

Fri, 14 Nov 2008 18:46:00 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 14 Nov 2008 18:46:00 +0000
changeset 264
a296b61baad8
parent 263
75275b6b4e03
child 265
1f851b6f5e11

Only reply with errors if the stanza is not an error or a result (don't know how much bandwidth this just cost me :) )

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Fri Nov 14 17:37:45 2008 +0000
+++ b/core/stanza_router.lua	Fri Nov 14 18:46:00 2008 +0000
@@ -174,16 +174,22 @@
 				stanza.attr.to = nil; -- reset it
 			else
 				log("warn", "Unhandled c2s presence: %s", tostring(stanza));
-				origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+				if stanza.attr.type ~= "error" then
+					origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+				end
 			end
 		else
 			log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
-			origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+			if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+				origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+			end
 		end -- TODO handle other stanzas
 	else
 		log("warn", "Unhandled origin: %s", origin.type);
-		-- s2s stanzas can get here
-		(origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+		if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+			-- s2s stanzas can get here
+			(origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+		end
 	end
 end
 

mercurial