Backout bcdff2b1d3ec from 0.8 - going to commit a slightly cleaner patch for the...
[prosody.git] / plugins / mod_message.lua
index 6ac23ab23b7ad5c6ba07e637e32faac50ae12e2c..df3175325b21f2488e19fa6e847c5ecef81be0c0 100644 (file)
@@ -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/handle', {
+                           origin = origin,
+                           stanza = stanza,
+                       });
+               end
+
+               if not ok then
                        origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
                end
        end