Diff

core/stanza_router.lua @ 250:9f66ede8deeb

Added error replies for unhandled stanzas
author Waqas Hussain <waqas20@gmail.com>
date Thu, 13 Nov 2008 19:14:31 +0500
parent 249:1fc47cf5d144
child 257:762274c98040
line wrap: on
line diff
--- 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