mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-24 17:29:28 +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
|
case check_event(From, To, Packet) of
|
||||||
true ->
|
true ->
|
||||||
#jid{luser = LUser, lserver = LServer} = To,
|
#jid{luser = LUser, lserver = LServer} = To,
|
||||||
|
case ejabberd_hooks:run_fold(store_offline_message, LServer,
|
||||||
|
Packet, [From, To]) of
|
||||||
|
drop ->
|
||||||
|
ok;
|
||||||
|
NewPacket ->
|
||||||
TimeStamp = p1_time_compat:timestamp(),
|
TimeStamp = p1_time_compat:timestamp(),
|
||||||
#xmlel{children = Els} = Packet,
|
#xmlel{children = Els} = NewPacket,
|
||||||
Expire = find_x_expire(TimeStamp, Els),
|
Expire = find_x_expire(TimeStamp, Els),
|
||||||
gen_mod:get_module_proc(To#jid.lserver, ?PROCNAME) !
|
gen_mod:get_module_proc(To#jid.lserver, ?PROCNAME) !
|
||||||
#offline_msg{us = {LUser, LServer},
|
#offline_msg{us = {LUser, LServer},
|
||||||
timestamp = TimeStamp, expire = Expire,
|
timestamp = TimeStamp,
|
||||||
from = From, to = To, packet = Packet},
|
expire = Expire,
|
||||||
stop;
|
from = From, to = To,
|
||||||
|
packet = NewPacket},
|
||||||
|
stop
|
||||||
|
end;
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end;
|
end;
|
||||||
false -> ok
|
false -> ok
|
||||||
|
Loading…
Reference in New Issue
Block a user