Fix bug in send_message introduced in 7fc500dae (#3485)

This commit is contained in:
Badlop 2021-01-31 23:07:13 +01:00
parent d3aeed839d
commit b3d9c0d1f7
1 changed files with 4 additions and 4 deletions

View File

@ -1494,10 +1494,10 @@ send_message(Type, From, To, Subject, Body) ->
#xmlel{name = <<"body">>,
children = [{xmlcdata, Body}]}]},
?NS_CLIENT, CodecOpts) of
#message{from = JID, subject = Subject, body = Body} = Msg ->
Msg2 = case {xmpp:get_text(Subject), xmpp:get_text(Body)} of
{_, <<>>} -> Msg;
{<<>>, _} -> Msg#message{subject = []};
#message{from = JID, subject = SubjectEl, body = BodyEl} = Msg ->
Msg2 = case {xmpp:get_text(SubjectEl), xmpp:get_text(BodyEl)} of
{Subject, <<>>} -> Msg;
{<<>>, Body} -> Msg#message{subject = []};
_ -> Msg
end,
State = #{jid => JID},