25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Reflect recent pubsub changes in configuration transformer

This commit is contained in:
Evgeny Khramtsov 2019-06-17 13:42:58 +03:00
parent 4fe995c272
commit 0c4818daca
2 changed files with 51 additions and 20 deletions

View File

@ -343,30 +343,30 @@ transform_module_options(Opts) ->
true true
end, Opts). end, Opts).
transform_module(_Host, mod_http_bind, Opts, Acc) -> transform_module(Host, mod_http_bind, Opts, Acc) ->
warn_replaced_module(mod_http_bind, mod_bosh), warn_replaced_module(mod_http_bind, mod_bosh),
{{mod_bosh, Opts}, Acc}; transform_module(Host, mod_bosh, Opts, Acc);
transform_module(_Host, mod_vcard_xupdate_odbc, Opts, Acc) -> transform_module(Host, mod_vcard_xupdate_odbc, Opts, Acc) ->
warn_replaced_module(mod_vcard_xupdate_odbc, mod_vcard_xupdate), warn_replaced_module(mod_vcard_xupdate_odbc, mod_vcard_xupdate),
{{mod_vcard_xupdate, Opts}, Acc}; transform_module(Host, mod_vcard_xupdate, Opts, Acc);
transform_module(_Host, mod_vcard_ldap, Opts, Acc) -> transform_module(Host, mod_vcard_ldap, Opts, Acc) ->
warn_replaced_module(mod_vcard_ldap, mod_vcard, ldap), warn_replaced_module(mod_vcard_ldap, mod_vcard, ldap),
{{mod_vcard, [{db_type, ldap}|Opts]}, Acc}; transform_module(Host, mod_vcard, [{db_type, ldap}|Opts], Acc);
transform_module(_Host, M, Opts, Acc) when (M == mod_announce_odbc orelse transform_module(Host, M, Opts, Acc) when (M == mod_announce_odbc orelse
M == mod_blocking_odbc orelse M == mod_blocking_odbc orelse
M == mod_caps_odbc orelse M == mod_caps_odbc orelse
M == mod_last_odbc orelse M == mod_last_odbc orelse
M == mod_muc_odbc orelse M == mod_muc_odbc orelse
M == mod_offline_odbc orelse M == mod_offline_odbc orelse
M == mod_privacy_odbc orelse M == mod_privacy_odbc orelse
M == mod_private_odbc orelse M == mod_private_odbc orelse
M == mod_pubsub_odbc orelse M == mod_pubsub_odbc orelse
M == mod_roster_odbc orelse M == mod_roster_odbc orelse
M == mod_shared_roster_odbc orelse M == mod_shared_roster_odbc orelse
M == mod_vcard_odbc) -> M == mod_vcard_odbc) ->
M1 = strip_odbc_suffix(M), M1 = strip_odbc_suffix(M),
warn_replaced_module(M, M1, sql), warn_replaced_module(M, M1, sql),
{{M1, [{db_type, sql}|Opts]}, Acc}; transform_module(Host, M1, [{db_type, sql}|Opts], Acc);
transform_module(_Host, mod_blocking, Opts, Acc) -> transform_module(_Host, mod_blocking, Opts, Acc) ->
Opts1 = lists:filter( Opts1 = lists:filter(
fun({db_type, _}) -> fun({db_type, _}) ->
@ -407,6 +407,34 @@ transform_module(_Host, mod_http_upload, Opts, Acc) ->
true true
end, Opts), end, Opts),
{{mod_http_upload, Opts1}, Acc}; {{mod_http_upload, Opts1}, Acc};
transform_module(_Host, mod_pubsub, Opts, Acc) ->
Opts1 = lists:map(
fun({plugins, Plugins}) ->
{plugins,
lists:filter(
fun(Plugin) ->
case lists:member(
Plugin,
[<<"buddy">>, <<"club">>, <<"dag">>,
<<"dispatch">>, <<"hometree">>, <<"mb">>,
<<"mix">>, <<"online">>, <<"private">>,
<<"public">>]) of
true ->
?WARNING_MSG(
"Plugin '~s' of mod_pubsub is not "
"supported anymore and has been "
"automatically removed from 'plugins' "
"option. ~s",
[Plugin, adjust_hint()]),
false;
false ->
true
end
end, Plugins)};
(Opt) ->
Opt
end, Opts),
{{mod_pubsub, Opts1}, Acc};
transform_module(_Host, Mod, Opts, Acc) -> transform_module(_Host, Mod, Opts, Acc) ->
{{Mod, Opts}, Acc}. {{Mod, Opts}, Acc}.
@ -524,6 +552,7 @@ validator() ->
#{'_' => #{'_' =>
econf:options( econf:options(
#{db_type => econf:atom(), #{db_type => econf:atom(),
plugins => econf:list(econf:binary()),
'_' => econf:any()}, '_' => econf:any()},
[])}, [])},
[]), []),

View File

@ -3892,7 +3892,9 @@ mod_opt_type(nodetree) ->
mod_opt_type(pep_mapping) -> mod_opt_type(pep_mapping) ->
econf:map(econf:binary(), econf:binary()); econf:map(econf:binary(), econf:binary());
mod_opt_type(plugins) -> mod_opt_type(plugins) ->
econf:list(econf:binary()); econf:list(
econf:enum([<<"flat">>, <<"pep">>]),
[unique]);
mod_opt_type(host) -> mod_opt_type(host) ->
econf:host(); econf:host();
mod_opt_type(hosts) -> mod_opt_type(hosts) ->