plugins/mod_iq.lua

changeset 1265
3f3c62e45eeb
parent 1260
04c1fae0eb03
child 1266
605a73234230
--- a/plugins/mod_iq.lua	Mon Jun 01 02:10:19 2009 +0100
+++ b/plugins/mod_iq.lua	Mon Jun 01 09:49:37 2009 +0500
@@ -1,3 +1,5 @@
+
+local st = require "util.stanza";
 
 local full_sessions = full_sessions;
 local bare_sessions = bare_sessions;
@@ -10,10 +12,12 @@
 	if session then
 		-- TODO fire post processing event
 		session.send(stanza);
-		return true;
 	else -- resource not online
-		-- TODO error reply
+		if stanza.attr.type == "get" or stanza.attr.type == "set" then
+			origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+		end
 	end
+	return true;
 end);
 
 module:hook("iq/bare", function(data)

mercurial