mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 17:59:31 +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(),
|
Host = ejabberd_config:get_myname(),
|
||||||
case user_id_from_jid(To, Host) of
|
case user_id_from_jid(To, Host) of
|
||||||
{ok, ToMatrixID} ->
|
{ok, ToMatrixID} ->
|
||||||
|
case xmpp:get_text(Body) of
|
||||||
|
<<"">> ->
|
||||||
|
ok;
|
||||||
|
Text ->
|
||||||
Key = {{From#jid.luser, From#jid.lserver}, ToMatrixID},
|
Key = {{From#jid.luser, From#jid.lserver}, ToMatrixID},
|
||||||
Text = xmpp:get_text(Body),
|
|
||||||
case mnesia:dirty_read(matrix_direct, Key) of
|
case mnesia:dirty_read(matrix_direct, Key) of
|
||||||
[#matrix_direct{room_id = RoomID}] ->
|
[#matrix_direct{room_id = RoomID}] ->
|
||||||
?DEBUG("msg ~p~n", [{RoomID, From, ToMatrixID, Text}]),
|
?DEBUG("msg ~p~n", [{RoomID, From, ToMatrixID, Text}]),
|
||||||
|
@ -365,6 +368,7 @@ route(#message{from = From, to = To, body = Body} = _Pkt) ->
|
||||||
%%TODO
|
%%TODO
|
||||||
ok
|
ok
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
error ->
|
error ->
|
||||||
ok
|
ok
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue