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

mod_mam: Simplify check for anon MUC JID filtering

Refuse filtering anon MUC MAM queries by JID even if it's the client's
own JID.  Clients probably won't perform such queries in practice, so
the additional complexity is unnecessary.
This commit is contained in:
Holger Weiss 2017-09-24 15:04:09 +02:00
parent d7250111ce
commit 59ec3d36f4

View File

@ -863,7 +863,7 @@ select(_LServer, JidRequestor, JidArchive, Query, RSM,
{Msgs, true, L}
end;
select(LServer, JidRequestor, JidArchive, Query, RSM, MsgType) ->
case might_expose_jid(JidRequestor, Query, MsgType) of
case might_expose_jid(Query, MsgType) of
true ->
{[], true, 0};
false ->
@ -993,22 +993,11 @@ match_rsm(Now, #rsm_set{before = ID}) when is_binary(ID), ID /= <<"">> ->
match_rsm(_Now, _) ->
true.
might_expose_jid(JidRequestor, Query, {groupchat, Role,
#state{config = #config{anonymous = true}}})
might_expose_jid(Query,
{groupchat, Role, #state{config = #config{anonymous = true}}})
when Role /= moderator ->
case proplists:get_value(with, Query) of
undefined ->
false;
With ->
case {jid:remove_resource(jid:tolower(With)),
jid:remove_resource(jid:tolower(JidRequestor))} of
{J, J} ->
false;
_ ->
true
end
end;
might_expose_jid(_JidRequestor, _Query, _MsgType) ->
proplists:is_defined(with, Query);
might_expose_jid(_Query, _MsgType) ->
false.
get_jids(undefined) ->