Skip to content

Commit

Permalink
system messages simply come from the room bare jid
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Aug 24, 2021
1 parent 543be65 commit bd87c8f
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/inbox/mod_inbox_muclight.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,14 @@ write_to_inbox(HostType, RoomUser, Remote, _Sender, Packet, Acc) ->
Sender :: jid:jid(),
Receiver :: jid:jid(),
Packet :: exml:element()) -> boolean().
is_system_message(HostType, Sender, Receiver, Packet) ->
ReceiverDomain = Receiver#jid.lserver,
MUCLightDomain = mod_muc_light:server_host_to_muc_host(HostType, ReceiverDomain),
case {Sender#jid.lserver, Sender#jid.lresource} of
{MUCLightDomain, <<>>} ->
true;
{MUCLightDomain, _RoomUser} ->
false;
_Other ->
?LOG_WARNING(#{what => inbox_muclight_unknown_message, packet => Packet,
sender => jid:to_binary(Sender), receiver => jid:to_binary(Receiver)})
end.

is_system_message(_HostType, #jid{lresource = <<>>}, _Receiver, _Packet) ->
true;
is_system_message(_HostType, #jid{lresource = _RoomUser}, _Receiver, _Packet) ->
false;
is_system_message(_HostType, Sender, Receiver, Packet) ->
?LOG_WARNING(#{what => inbox_muclight_unknown_message, packet => Packet,
sender => jid:to_binary(Sender), receiver => jid:to_binary(Receiver)}),
false.

-spec is_change_aff_message(jid:jid(), exml:element(), role()) -> boolean().
is_change_aff_message(User, Packet, Role) ->
Expand All @@ -176,7 +171,7 @@ system_message_type(User, Packet) ->
kick;
true ->
other
end.
end.

-spec is_invitation_message(jid:jid(), exml:element()) -> boolean().
is_invitation_message(User, Packet) ->
Expand Down

0 comments on commit bd87c8f

Please sign in to comment.