From 4a34bb9adef891a5451fdb3648c72c37bf54d744 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 28 Feb 2009 04:58:14 +0000 Subject: core.stanza_router: Reply with error to groupchat messages directed at unavailable resources or offline users --- core/stanza_router.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core') diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 1ebc158d..29a4797b 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -217,6 +217,9 @@ function core_route_stanza(origin, stanza) 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 @@ function core_route_stanza(origin, stanza) 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 -- cgit v1.2.3