mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-03 18:02:28 +01:00
Don't include empty <subject/> in messages sent by send_message
Please refer issue #3485
This commit is contained in:
parent
b6d90cc55c
commit
7fc500dae6
@ -1494,10 +1494,15 @@ send_message(Type, From, To, Subject, Body) ->
|
|||||||
#xmlel{name = <<"body">>,
|
#xmlel{name = <<"body">>,
|
||||||
children = [{xmlcdata, Body}]}]},
|
children = [{xmlcdata, Body}]}]},
|
||||||
?NS_CLIENT, CodecOpts) of
|
?NS_CLIENT, CodecOpts) of
|
||||||
#message{from = JID} = Msg ->
|
#message{from = JID, subject = Subject, body = Body} = Msg ->
|
||||||
|
Msg2 = case {xmpp:get_text(Subject), xmpp:get_text(Body)} of
|
||||||
|
{_, <<>>} -> Msg;
|
||||||
|
{<<>>, _} -> Msg#message{subject = []};
|
||||||
|
_ -> Msg
|
||||||
|
end,
|
||||||
State = #{jid => JID},
|
State = #{jid => JID},
|
||||||
ejabberd_hooks:run_fold(user_send_packet, JID#jid.lserver, {Msg, State}, []),
|
ejabberd_hooks:run_fold(user_send_packet, JID#jid.lserver, {Msg2, State}, []),
|
||||||
ejabberd_router:route(Msg)
|
ejabberd_router:route(Msg2)
|
||||||
catch _:{xmpp_codec, Why} ->
|
catch _:{xmpp_codec, Why} ->
|
||||||
{error, xmpp:format_error(Why)}
|
{error, xmpp:format_error(Why)}
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user