Added error replies for unhandled stanzas

Thu, 13 Nov 2008 19:14:31 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Thu, 13 Nov 2008 19:14:31 +0500
changeset 250
9f66ede8deeb
parent 249
1fc47cf5d144
child 251
5b6dec537914

Added error replies for unhandled stanzas

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Thu Nov 13 12:13:13 2008 +0500
+++ b/core/stanza_router.lua	Thu Nov 13 19:14:31 2008 +0500
@@ -173,11 +173,16 @@
 				end
 				stanza.attr.to = nil; -- reset it
 			else
-				-- TODO error, bad type
+				log("warn", "Unhandled c2s presence: %s", tostring(stanza));
+				origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
 			end
+		else
+			log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
+			origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
 		end -- TODO handle other stanzas
 	else
-		log("warn", "Unhandled origin: %s", origin.type); -- FIXME reply with error
+		log("warn", "Unhandled origin: %s", origin.type);
+		origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
 	end
 end
 

mercurial