aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-02-28 04:58:14 +0000
committerMatthew Wild <mwild1@gmail.com>2009-02-28 04:58:14 +0000
commit4a34bb9adef891a5451fdb3648c72c37bf54d744 (patch)
treed10e6f59c64240908755ae122960f0a388d7de35
parent8c36520f60140741cde82860a05b39fbe1844535 (diff)
downloadprosody-4a34bb9adef891a5451fdb3648c72c37bf54d744.tar.gz
prosody-4a34bb9adef891a5451fdb3648c72c37bf54d744.zip
core.stanza_router: Reply with error to groupchat messages directed at unavailable resources or offline users
-rw-r--r--core/stanza_router.lua7
1 files changed, 7 insertions, 0 deletions
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