25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

mod_blocking_sql: Handle default list corner case

Handle the situation where a list of the name "Blocked contacts" was
created by an XEP-0016 client, but no default list exists.
This commit is contained in:
Holger Weiss 2016-06-22 22:36:27 +02:00
parent 751be3cca6
commit 065f5272e6

View File

@ -25,7 +25,12 @@ process_blocklist_block(LUser, LServer, Filter) ->
Default = case mod_privacy_sql:sql_get_default_privacy_list_t(LUser) of
{selected, []} ->
Name = <<"Blocked contacts">>,
mod_privacy_sql:sql_add_privacy_list(LUser, Name),
case mod_privacy_sql:sql_get_privacy_list_id_t(LUser, Name) of
{selected, []} ->
mod_privacy_sql:sql_add_privacy_list(LUser, Name);
{selected, [{_ID}]} ->
ok
end,
mod_privacy_sql:sql_set_default_privacy_list(LUser, Name),
Name;
{selected, [{Name}]} -> Name