mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
mod_offline: Add 'store_offline_message' hook
The new 'store_offline_message' hook is invoked whenever an offline message is stored.
This commit is contained in:
parent
4d19fb518f
commit
8821cf8b27
@ -476,14 +476,22 @@ store_packet(From, To, Packet) ->
|
||||
case check_event(From, To, Packet) of
|
||||
true ->
|
||||
#jid{luser = LUser, lserver = LServer} = To,
|
||||
TimeStamp = p1_time_compat:timestamp(),
|
||||
#xmlel{children = Els} = Packet,
|
||||
Expire = find_x_expire(TimeStamp, Els),
|
||||
gen_mod:get_module_proc(To#jid.lserver, ?PROCNAME) !
|
||||
#offline_msg{us = {LUser, LServer},
|
||||
timestamp = TimeStamp, expire = Expire,
|
||||
from = From, to = To, packet = Packet},
|
||||
stop;
|
||||
case ejabberd_hooks:run_fold(store_offline_message, LServer,
|
||||
Packet, [From, To]) of
|
||||
drop ->
|
||||
ok;
|
||||
NewPacket ->
|
||||
TimeStamp = p1_time_compat:timestamp(),
|
||||
#xmlel{children = Els} = NewPacket,
|
||||
Expire = find_x_expire(TimeStamp, Els),
|
||||
gen_mod:get_module_proc(To#jid.lserver, ?PROCNAME) !
|
||||
#offline_msg{us = {LUser, LServer},
|
||||
timestamp = TimeStamp,
|
||||
expire = Expire,
|
||||
from = From, to = To,
|
||||
packet = NewPacket},
|
||||
stop
|
||||
end;
|
||||
_ -> ok
|
||||
end;
|
||||
false -> ok
|
||||
|
Loading…
Reference in New Issue
Block a user