Changeset

1265:3f3c62e45eeb

mod_iq: Error reply for IQ to non-existing session. mod_iq now handles all 'iq/full' cases
author Waqas Hussain <waqas20@gmail.com>
date Mon, 01 Jun 2009 09:49:37 +0500
parents 1264:498293bce4bf
children 1266:605a73234230
files plugins/mod_iq.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)