core.stanza_router: Reply with error to groupchat messages directed at unavailable resources or offline users

Sat, 28 Feb 2009 04:58:14 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 28 Feb 2009 04:58:14 +0000
changeset 848
b1f3977fd140
parent 847
2d424936723c
child 849
5049b4512df0

core.stanza_router: Reply with error to groupchat messages directed at unavailable resources or offline users

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- 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

mercurial