diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2020-01-05 20:08:54 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2020-01-05 20:08:54 +0100 |
commit | 0e96d64e6031b372680e681a4b3602dcad7d801d (patch) | |
tree | 34c7439647a00a43c63826e8d3171eddb630d007 /src/mod_offline.erl | |
parent | Travis CI: Test against Erlang/OTP 22.2 (diff) |
Omit push notifications if offline storage failed
This commit removes the 'store_offline_message' hook which didn't allow
mod_push to suppress notifications when storing an offline message
failed (due to the offline spool size limit being exceeded or due to
database issues).
Fixes #3120.
Diffstat (limited to 'src/mod_offline.erl')
-rw-r--r-- | src/mod_offline.erl | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/mod_offline.erl b/src/mod_offline.erl index c3fca886..6a3f3f2d 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -493,26 +493,20 @@ store_packet({_Action, #message{from = From, to = To} = Packet} = Acc) -> case check_event(Packet) of true -> #jid{luser = LUser, lserver = LServer} = To, - case ejabberd_hooks:run_fold(store_offline_message, LServer, - Packet, []) of - drop -> - Acc; - NewPacket -> - TimeStamp = erlang:timestamp(), - Expire = find_x_expire(TimeStamp, NewPacket), - OffMsg = #offline_msg{us = {LUser, LServer}, - timestamp = TimeStamp, - expire = Expire, - from = From, - to = To, - packet = NewPacket}, - case store_offline_msg(OffMsg) of - ok -> - {offlined, NewPacket}; - {error, Reason} -> - discard_warn_sender(Packet, Reason), - stop - end + TimeStamp = erlang:timestamp(), + Expire = find_x_expire(TimeStamp, Packet), + OffMsg = #offline_msg{us = {LUser, LServer}, + timestamp = TimeStamp, + expire = Expire, + from = From, + to = To, + packet = Packet}, + case store_offline_msg(OffMsg) of + ok -> + {offlined, Packet}; + {error, Reason} -> + discard_warn_sender(Packet, Reason), + stop end; _ -> maybe_update_cache(To, Packet), |