24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-28 22:52:27 +02: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}) -> {route_single, Group}) ->
lists:foreach( lists:foreach(
fun(ToUser) -> fun(ToUser) ->
Group_others = strip_other_bcc(ToUser, Group#group.others),
route_packet(From, ToUser, Packet, route_packet(From, ToUser, Packet,
Group#group.others, Group#group.addresses) Group_others, Group#group.addresses)
end, Group#group.dests); end, Group#group.dests);
perform(From, Packet, _, perform(From, Packet, _,
{{route_multicast, JID, RLimits}, Group}) -> {{route_multicast, JID, RLimits}, Group}) ->
@ -424,6 +425,21 @@ strip_addresses_element(Packet) ->
throw(eadsele) throw(eadsele)
end. 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 %%% Split Addresses
%%%------------------------- %%%-------------------------
@ -545,7 +561,6 @@ build_other_xml(Dests) ->
case Dest#dest.type of case Dest#dest.type of
to -> [add_delivered(XML) | R]; to -> [add_delivered(XML) | R];
cc -> [add_delivered(XML) | R]; cc -> [add_delivered(XML) | R];
bcc -> R;
_ -> [XML | R] _ -> [XML | R]
end end
end, end,