Diff

core/stanza_router.lua @ 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
parent 789:ced87939984e
child 854:b9cfc9d5496a
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