Changeset

848:b1f3977fd140

core.stanza_router: Reply with error to groupchat messages directed at unavailable resources or offline users
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Feb 2009 04:58:14 +0000
parents 847:2d424936723c
children 849:5049b4512df0
files core/stanza_router.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/stanza_router.lua	Sat Feb 28 02:05:37 2009 +0000
+++ b/core/stanza_router.lua	Sat Feb 28 04:58:14 2009 +0000
@@ -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,6 +266,10 @@
 					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