25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Merge pull request #3639 from McPo/xep0033-bcc-strip-fix

Correctly strip only third-party bcc addresses
This commit is contained in:
badlop 2021-07-07 19:07:21 +02:00 committed by GitHub
commit 42fdac0b41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -392,8 +392,9 @@ perform(From, Packet, _,
{route_single, Group}) ->
lists:foreach(
fun(ToUser) ->
Group_others = strip_other_bcc(ToUser, Group#group.others),
route_packet(From, ToUser, Packet,
Group#group.others, Group#group.addresses)
Group_others, Group#group.addresses)
end, Group#group.dests);
perform(From, Packet, _,
{{route_multicast, JID, RLimits}, Group}) ->
@ -424,6 +425,21 @@ strip_addresses_element(Packet) ->
throw(eadsele)
end.
%%%-------------------------
%%% Strip third-party bcc 'addresses'
%%%-------------------------
strip_other_bcc(#dest{jid_jid = ToUserJid}, Group_others) ->
lists:filter(
fun(#address{jid = JID, type = Type}) ->
case {JID, Type} of
{ToUserJid, bcc} -> true;
{_, bcc} -> false;
_ -> true
end
end,
Group_others).
%%%-------------------------
%%% Split Addresses
%%%-------------------------
@ -545,7 +561,6 @@ build_other_xml(Dests) ->
case Dest#dest.type of
to -> [add_delivered(XML) | R];
cc -> [add_delivered(XML) | R];
bcc -> R;
_ -> [XML | R]
end
end,