mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Run user_receive_packet in send_message so MAM stores also incoming (#3377)
This commit is contained in:
parent
eada3b6e93
commit
43f813d6f8
@ -1494,14 +1494,18 @@ send_message(Type, From, To, Subject, Body) ->
|
||||
#xmlel{name = <<"body">>,
|
||||
children = [{xmlcdata, Body}]}]},
|
||||
?NS_CLIENT, CodecOpts) of
|
||||
#message{from = JID} = Msg ->
|
||||
State = #{jid => JID},
|
||||
ejabberd_hooks:run_fold(user_send_packet, JID#jid.lserver, {Msg, State}, []),
|
||||
#message{from = FromJid, to = ToJid} = Msg1 ->
|
||||
Msg = xmpp:put_meta(Msg1, stanza_id, mod_mam:make_id()),
|
||||
ejabberd_hooks:run_fold(user_send_packet, FromJid#jid.lserver,
|
||||
{Msg, #{jid => FromJid}}, []),
|
||||
ejabberd_hooks:run_fold(user_receive_packet, FromJid#jid.lserver,
|
||||
{Msg, #{jid => ToJid}}, []),
|
||||
ejabberd_router:route(Msg)
|
||||
catch _:{xmpp_codec, Why} ->
|
||||
{error, xmpp:format_error(Why)}
|
||||
end.
|
||||
|
||||
|
||||
send_stanza(FromString, ToString, Stanza) ->
|
||||
try
|
||||
#xmlel{} = El = fxml_stream:parse_element(Stanza),
|
||||
|
Loading…
Reference in New Issue
Block a user