Changeset

111:0abe771b43c6

Fixed: Unhandled stanza handling
author Waqas Hussain <waqas20@gmail.com>
date Wed, 22 Oct 2008 21:20:29 +0500
parents 110:bb5ac5976a97
children 112:df54cab4ff9c
files core/servermanager.lua
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/core/servermanager.lua	Wed Oct 22 21:20:07 2008 +0500
+++ b/core/servermanager.lua	Wed Oct 22 21:20:29 2008 +0500
@@ -10,11 +10,13 @@
 	-- Use plugins
 	if not modulemanager.handle_stanza(origin, stanza) then
 		if stanza.name == "iq" then
-			local reply = st.reply(stanza);
-			reply.attr.type = "error";
-			reply:tag("error", { type = "cancel" })
-				:tag("service-unavailable", { xmlns = xmlns_stanzas });
-			send(origin, reply);
+			if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then
+				send(origin, st.error_reply(stanza, "cancel", "service-unavailable"));
+			end
+		elseif stanza.name == "message" then
+			send(origin, st.error_reply(stanza, "cancel", "service-unavailable"));
+		elseif stanza.name ~= "presence" then
+			error("Unknown stanza");
 		end
 	end
 end