Diff

core/stanza_router.lua @ 862:b3b80ccddb0c

Merged with main tip.
author Tobias Markmann <tm@ayena.de>
date Tue, 03 Mar 2009 17:48:04 +0100
parent 854:b9cfc9d5496a
child 894:b61c3589cd7b
child 896:2c0b9e3c11c3
line wrap: on
line diff
--- a/core/stanza_router.lua	Sun Feb 22 20:57:57 2009 +0100
+++ b/core/stanza_router.lua	Tue Mar 03 17:48:04 2009 +0100
@@ -217,6 +217,9 @@
 								session.send(stanza);
 							end
 						end
+					elseif resource and stanza.attr.type == 'groupchat' then
+						-- Groupchat message sent to offline resource
+						origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 					else
 						local priority = 0;
 						local recipients = {};
@@ -263,10 +266,14 @@
 					if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then
 						offlinemanager.store(node, host, stanza);
 						-- FIXME don't store messages with only chat state notifications
+					elseif stanza.attr.type == "groupchat" then
+						local reply = st.error_reply(stanza, "cancel", "service-unavailable");
+						reply.attr.from = to;
+						origin.send(reply);
 					end
 					-- TODO allow configuration of offline storage
 					-- TODO send error if not storing offline
-				elseif stanza.name == "iq" then
+				elseif stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then
 					origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 				end
 			else -- user does not exist
@@ -277,7 +284,7 @@
 						origin.send(st.presence({from = to_bare, to = from_bare, type = "unsubscribed"}));
 					end
 					-- else ignore
-				else
+				elseif stanza.attr.type ~= "error" and (stanza.name ~= "iq" or stanza.attr.type ~= "result") then
 					origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 				end
 			end