Skip to content

Commit

Permalink
remove allow_return_all optonion for mnesia and odbc vcard backends
Browse files Browse the repository at this point in the history
  • Loading branch information
michalwski committed Jul 1, 2015
1 parent d8b4249 commit 1df7cca
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
8 changes: 3 additions & 5 deletions apps/ejabberd/src/mod_vcard_mnesia.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ set_vcard(User, VHost, VCard, VCardSearch) ->

search(VHost, Data, _Lang, DefaultReportedFields) ->
MatchHead = make_matchhead(VHost, Data),
AllowReturnAll = gen_mod:get_module_opt(VHost, mod_vcard,
allow_return_all, false),
R=if
(MatchHead == #vcard_search{_ = '_'}) and (not AllowReturnAll) ->
case MatchHead of
#vcard_search{_ = '_'} ->
[];
true ->
_ ->
case catch mnesia:dirty_select(vcard_search,
[{MatchHead, [], ['$_']}]) of
{'EXIT', Reason} ->
Expand Down
14 changes: 6 additions & 8 deletions apps/ejabberd/src/mod_vcard_odbc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ set_vcard(User, VHost, VCard, VCardSearch) ->

search(LServer, Data, _Lang, DefaultReportedFields) ->
RestrictionSQL = make_restriction_sql(LServer, Data),
AllowReturnAll = gen_mod:get_module_opt(LServer, mod_vcard,
allow_return_all, false),

R=if
(RestrictionSQL == "") and (not AllowReturnAll) ->
[];
true ->
do_search(LServer, RestrictionSQL)

case RestrictionSQL of
"" ->
[];
true ->
do_search(LServer, RestrictionSQL)
end,
Items = lists:map(fun(I) -> record_to_item(LServer,I) end, R),
[DefaultReportedFields | Items].
Expand Down
3 changes: 1 addition & 2 deletions rel/reltool_vars/node1_vars.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
{mod_privacy, "{mod_privacy, []},"}.
{mod_private, "{mod_private, []},"}.
{mod_roster, "{mod_roster, []},"}.
{mod_vcard, "{mod_vcard, [ {allow_return_all, true},\n"
"%{matches, 1},\n"
{mod_vcard, "{mod_vcard, [ %{matches, 1},\n"
"%{search, true},\n"
"%{host, directory.@HOST@}\n"
"]},"}.
Expand Down
3 changes: 1 addition & 2 deletions rel/reltool_vars/node2_vars.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
{mod_privacy, "{mod_privacy, []},"}.
{mod_private, "{mod_private, []},"}.
{mod_roster, "{mod_roster, []},"}.
{mod_vcard, "{mod_vcard, [ {allow_return_all, true},\n"
"%{matches, 1},\n"
{mod_vcard, "{mod_vcard, [ %{matches, 1},\n"
"%{search, true},\n"
"%{host, directory.@HOST@}\n"
"]},"}.
3 changes: 1 addition & 2 deletions rel/vars.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
{mod_privacy, "{mod_privacy, []},"}.
{mod_private, "{mod_private, []},"}.
{mod_roster, "{mod_roster, []},"}.
{mod_vcard, "{mod_vcard, [ {allow_return_all, true},\n"
"%{matches, 1},\n"
{mod_vcard, "{mod_vcard, [%{matches, 1},\n"
"%{search, true},\n"
"%{host, directory.@HOST@}\n"
"]},"}.
Expand Down

0 comments on commit 1df7cca

Please sign in to comment.