Changeset

250:9f66ede8deeb

Added error replies for unhandled stanzas
author Waqas Hussain <waqas20@gmail.com>
date Thu, 13 Nov 2008 19:14:31 +0500
parents 249:1fc47cf5d144
children 251:5b6dec537914
files core/stanza_router.lua
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
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