mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
Don't send empty direct Matrix messages (thanks to snoopcatt) (#4420)
This commit is contained in:
parent
a02c75aa08
commit
8b61cf0742
1 changed files with 103 additions and 99 deletions
|
@ -265,8 +265,11 @@ route(#message{from = From, to = To, body = Body} = _Pkt) ->
|
|||
Host = ejabberd_config:get_myname(),
|
||||
case user_id_from_jid(To, Host) of
|
||||
{ok, ToMatrixID} ->
|
||||
case xmpp:get_text(Body) of
|
||||
<<"">> ->
|
||||
ok;
|
||||
Text ->
|
||||
Key = {{From#jid.luser, From#jid.lserver}, ToMatrixID},
|
||||
Text = xmpp:get_text(Body),
|
||||
case mnesia:dirty_read(matrix_direct, Key) of
|
||||
[#matrix_direct{room_id = RoomID}] ->
|
||||
?DEBUG("msg ~p~n", [{RoomID, From, ToMatrixID, Text}]),
|
||||
|
@ -365,6 +368,7 @@ route(#message{from = From, to = To, body = Body} = _Pkt) ->
|
|||
%%TODO
|
||||
ok
|
||||
end
|
||||
end
|
||||
end;
|
||||
error ->
|
||||
ok
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue