aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Hoelz <rob@hoelz.ro>2010-12-09 12:36:29 -0600
committerRobert Hoelz <rob@hoelz.ro>2010-12-09 12:36:29 -0600
commit5211c741efc2070ad7fa1bdad132fd7b6423ce53 (patch)
tree1a6e17f69c223886a8311a96db7dc3fe9a820977
parentf60a52f7131ceaba2f1baaa87f12a0ff8004b1ba (diff)
downloadprosody-5211c741efc2070ad7fa1bdad132fd7b6423ce53.tar.gz
prosody-5211c741efc2070ad7fa1bdad132fd7b6423ce53.zip
mod_message: Send service-unavailable if offline storage fails.
-rw-r--r--plugins/mod_message.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua
index 6ac23ab2..bd4e353a 100644
--- a/plugins/mod_message.lua
+++ b/plugins/mod_message.lua
@@ -44,14 +44,17 @@ local function process_to_bare(bare, origin, stanza)
end
-- no resources are online
local node, host = jid_split(bare);
+ local ok
if user_exists(node, host) then
-- TODO apply the default privacy list
- module:fire_event('message/offline/store', {
- origin = origin,
- stanza = stanza,
- });
- else
+ ok = module:fire_event('message/offline/store', {
+ origin = origin,
+ stanza = stanza,
+ });
+ end
+
+ if not ok then
origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
end
end