mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Merge pull request #3639 from McPo/xep0033-bcc-strip-fix
Correctly strip only third-party bcc addresses
This commit is contained in:
commit
42fdac0b41
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user