mirror of
https://github.com/processone/ejabberd
synced 2025-10-06 03:50:15 +02:00
Update more SQL queries
This commit is contained in:
parent
6d7ce0237a
commit
d8fbe8a289
7 changed files with 225 additions and 315 deletions
|
@ -223,23 +223,18 @@ process_blocklist_block(LUser, LServer, Filter, odbc) ->
|
|||
Default = case
|
||||
mod_privacy:sql_get_default_privacy_list_t(LUser)
|
||||
of
|
||||
{selected, [<<"name">>], []} ->
|
||||
{selected, []} ->
|
||||
Name = <<"Blocked contacts">>,
|
||||
mod_privacy:sql_add_privacy_list(LUser, Name),
|
||||
mod_privacy:sql_set_default_privacy_list(LUser,
|
||||
Name),
|
||||
Name;
|
||||
{selected, [<<"name">>], [[Name]]} -> Name
|
||||
{selected, [{Name}]} -> Name
|
||||
end,
|
||||
{selected, [<<"id">>], [[ID]]} =
|
||||
{selected, [{ID}]} =
|
||||
mod_privacy:sql_get_privacy_list_id_t(LUser, Default),
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID)
|
||||
of
|
||||
{selected,
|
||||
[<<"t">>, <<"value">>, <<"action">>, <<"ord">>,
|
||||
<<"match_all">>, <<"match_iq">>, <<"match_message">>,
|
||||
<<"match_presence_in">>, <<"match_presence_out">>],
|
||||
RItems = [_ | _]} ->
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID) of
|
||||
{selected, RItems = [_ | _]} ->
|
||||
List = lists:flatmap(fun mod_privacy:raw_to_item/1, RItems);
|
||||
_ -> List = []
|
||||
end,
|
||||
|
@ -345,17 +340,12 @@ unblock_by_filter(LUser, LServer, Filter, odbc) ->
|
|||
F = fun () ->
|
||||
case mod_privacy:sql_get_default_privacy_list_t(LUser)
|
||||
of
|
||||
{selected, [<<"name">>], []} -> ok;
|
||||
{selected, [<<"name">>], [[Default]]} ->
|
||||
{selected, [<<"id">>], [[ID]]} =
|
||||
{selected, []} -> ok;
|
||||
{selected, [{Default}]} ->
|
||||
{selected, [{ID}]} =
|
||||
mod_privacy:sql_get_privacy_list_id_t(LUser, Default),
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID)
|
||||
of
|
||||
{selected,
|
||||
[<<"t">>, <<"value">>, <<"action">>, <<"ord">>,
|
||||
<<"match_all">>, <<"match_iq">>, <<"match_message">>,
|
||||
<<"match_presence_in">>, <<"match_presence_out">>],
|
||||
RItems = [_ | _]} ->
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID) of
|
||||
{selected, RItems = [_ | _]} ->
|
||||
List = lists:flatmap(fun mod_privacy:raw_to_item/1,
|
||||
RItems),
|
||||
NewList = Filter(List),
|
||||
|
@ -435,16 +425,12 @@ process_blocklist_get(LUser, LServer, odbc) ->
|
|||
case catch
|
||||
mod_privacy:sql_get_default_privacy_list(LUser, LServer)
|
||||
of
|
||||
{selected, [<<"name">>], []} -> [];
|
||||
{selected, [<<"name">>], [[Default]]} ->
|
||||
{selected, []} -> [];
|
||||
{selected, [{Default}]} ->
|
||||
case catch mod_privacy:sql_get_privacy_list_data(LUser,
|
||||
LServer, Default)
|
||||
of
|
||||
{selected,
|
||||
[<<"t">>, <<"value">>, <<"action">>, <<"ord">>,
|
||||
<<"match_all">>, <<"match_iq">>, <<"match_message">>,
|
||||
<<"match_presence_in">>, <<"match_presence_out">>],
|
||||
RItems} ->
|
||||
{selected, RItems} ->
|
||||
lists:flatmap(fun mod_privacy:raw_to_item/1, RItems);
|
||||
{'EXIT', _} -> error
|
||||
end;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue