diff options
| author | badlop <badlop@process-one.net> | 2021-07-07 19:07:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-07 19:07:21 +0200 |
| commit | 42fdac0b41bdbe086424676be105038f6d3b42bc (patch) | |
| tree | 276c6b5c3fb9b3e7ec0fb9469eb68533afe4b68b | |
| parent | Tell relx to include src, so that the tar will contain include/ (#3633) (diff) | |
| parent | Correctly strip only other bcc addresses i.e. bcc receiver should still be ab... (diff) | |
Merge pull request #3639 from McPo/xep0033-bcc-strip-fix
Correctly strip only third-party bcc addresses
| -rw-r--r-- | src/mod_multicast.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mod_multicast.erl b/src/mod_multicast.erl index 530bfecea..161d3a4c4 100644 --- a/src/mod_multicast.erl +++ b/src/mod_multicast.erl @@ -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}) -> @@ -425,6 +426,21 @@ strip_addresses_element(Packet) -> 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, |
