Skip to content

Commit

Permalink
mod_roster: Only include MIX elements when <annotate/> is set
Browse files Browse the repository at this point in the history
Currently only works with roster get requests. Not roster pushes.
  • Loading branch information
lnjX committed Jul 2, 2022
1 parent 2707927 commit 825c238
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/mod_roster.erl
Expand Up @@ -275,7 +275,7 @@ write_roster_version(LUser, LServer, InTransaction) ->
%% - the roster version from client don't match current version.
-spec process_iq_get(iq()) -> iq().
process_iq_get(#iq{to = To,
sub_els = [#roster_query{ver = RequestedVersion}]} = IQ) ->
sub_els = [#roster_query{ver = RequestedVersion, mix_annotate = MixAnnotate}]} = IQ) ->
LUser = To#jid.luser,
LServer = To#jid.lserver,
US = {LUser, LServer},
Expand Down Expand Up @@ -313,9 +313,21 @@ process_iq_get(#iq{to = To,
roster_get, To#jid.lserver, [], [US])),
false}
end,
% don't include <channel/> element when MIX annotate is disabled
Items = case ItemsToSend of
false -> false;
I -> case MixAnnotate of
undefined ->
lists:map(
fun(Item) ->
Item#roster_item{mix_channel = undefined}
end, I);
#mix_roster_annotate{} -> I
end
end,
xmpp:make_iq_result(
IQ,
case {ItemsToSend, VersionToSend} of
case {Items, VersionToSend} of
{false, false} ->
undefined;
{Items, false} ->
Expand Down

0 comments on commit 825c238

Please sign in to comment.