]> granicus.if.org Git - ejabberd/commitdiff
Add type specs for Module:opt_type/1
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 8 May 2017 09:59:28 +0000 (12:59 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 8 May 2017 09:59:28 +0000 (12:59 +0300)
40 files changed:
src/cyrsasl_digest.erl
src/ejabberd_app.erl
src/ejabberd_auth.erl
src/ejabberd_auth_anonymous.erl
src/ejabberd_auth_external.erl
src/ejabberd_auth_ldap.erl
src/ejabberd_auth_pam.erl
src/ejabberd_c2s.erl
src/ejabberd_captcha.erl
src/ejabberd_commands.erl
src/ejabberd_config.erl
src/ejabberd_ctl.erl
src/ejabberd_http.erl
src/ejabberd_oauth.erl
src/ejabberd_oauth_rest.erl
src/ejabberd_rdbms.erl
src/ejabberd_receiver.erl
src/ejabberd_redis_sup.erl
src/ejabberd_riak_sup.erl
src/ejabberd_router.erl
src/ejabberd_s2s.erl
src/ejabberd_s2s_in.erl
src/ejabberd_s2s_out.erl
src/ejabberd_service.erl
src/ejabberd_sm.erl
src/ejabberd_sql.erl
src/ejabberd_sql_sup.erl
src/ejabberd_system_monitor.erl
src/ejabberd_web_admin.erl
src/eldap_utils.erl
src/ext_mod.erl
src/extauth.erl
src/gen_iq_handler.erl
src/gen_mod.erl
src/mod_metrics.erl
src/mod_register.erl
src/mod_vcard_ldap.erl
src/rest.erl
src/shaper.erl
src/sql_queries.erl

index 9d23271d187dd4199e98a5736e607c7bcad5253c..5bce53a02eb6b1ff4c14319e486ad864ce02300a 100644 (file)
@@ -260,6 +260,8 @@ response(KeyVals, User, Passwd, Nonce, AuthzId,
          ":", (hex((erlang:md5(A2))))/binary>>,
     hex((erlang:md5(T))).
 
+-spec opt_type(fqdn) -> fun((binary() | [binary()]) -> [binary()]);
+             (atom()) -> [atom()].
 opt_type(fqdn) ->
     fun(FQDN) when is_binary(FQDN) ->
            [FQDN];
index b23249aa006e4d949ae4f6ee6f90400d30eacd86..b52450d24a5b039a0cbd52bb81a0a594799462a6 100644 (file)
@@ -160,6 +160,9 @@ start_apps() ->
     ejabberd:start_app(xmpp),
     ejabberd:start_app(cache_tab).
 
+-spec opt_type(net_ticktime) -> fun((pos_integer()) -> pos_integer());
+             (cluster_nodes) -> fun(([node()]) -> [node()]);
+             (atom()) -> atom().
 opt_type(net_ticktime) ->
     fun (P) when is_integer(P), P > 0 -> P end;
 opt_type(cluster_nodes) ->
index 756fafcf67747a48c33d88f9fc66a77fac117b5c..9751142a5a508751e7dacb3f5f39eb63d2fd01a5 100644 (file)
@@ -534,6 +534,9 @@ import(Server, {sql, _}, riak, <<"users">>, Fields) ->
 import(_LServer, {sql, _}, sql, <<"users">>, _) ->
     ok.
 
+-spec opt_type(auth_method) -> fun((atom() | [atom()]) -> [atom()]);
+             (auth_password_format) -> fun((plain | scram) -> plain | scram);
+             (atom()) -> [atom()].
 opt_type(auth_method) ->
     fun (V) when is_list(V) ->
            lists:map(fun(M) -> ejabberd_config:v_db(?MODULE, M) end, V);
index a75af709ed6c49387ef24d6c6da4db5b35e80c80..5bb2daed74ae60c4f85505ebe5a95b7758898ad5 100644 (file)
@@ -236,6 +236,10 @@ plain_password_required() -> false.
 store_type() ->
        plain.
 
+-spec opt_type(allow_multiple_connection) -> fun((boolean()) -> boolean());
+             (anonymous_protocol) -> fun((sasl_anon | login_anon | both) ->
+                                                sasl_anon | login_anon | both);
+             (atom()) -> [atom()].
 opt_type(allow_multiple_connections) ->
     fun (V) when is_boolean(V) -> V end;
 opt_type(anonymous_protocol) ->
index 8ba2e2b221a0287f050008c2c19d0bcddab5b691..5bdd704a0e2bb606a3b1b799cb1aa12d32ff7009 100644 (file)
@@ -313,6 +313,10 @@ is_configured(Host, Module) ->
     Os = ejabberd_config:get_option({modules, Host}, []),
     lists:keymember(Module, 1, Os).
 
+-spec opt_type(extauth_cache) -> fun((false | non_neg_integer()) ->
+                                     false | non_neg_integer());
+             (extauth_program) -> fun((binary()) -> string());
+             (atom()) -> [atom()].
 opt_type(extauth_cache) ->
     fun (false) -> false;
        (I) when is_integer(I), I >= 0 -> I
index 53c2564907d32ac28c03861dc9765b0d305db110..8a4532e38b7bb8c7a6ee1d4d437d09b76f088ee8 100644 (file)
@@ -393,6 +393,10 @@ parse_options(Host) ->
           sfilter = SearchFilter, lfilter = LocalFilter,
           dn_filter = DNFilter, dn_filter_attrs = DNFilterAttrs}.
 
+-spec opt_type(ldap_dn_filter) -> fun(([{binary(), binary()}]) ->
+                                      [{binary(), binary()}]);
+             (ldap_local_filter) -> fun((any()) -> any());
+             (atom()) -> [atom()].
 opt_type(ldap_dn_filter) ->
     fun ([{DNF, DNFA}]) ->
            NewDNFA = case DNFA of
index 974cc8e43c107e41baf22c3675aa7f7b4794c4ad..9d2fc819b7982db64c2333ef3955ca0b0f101fa2 100644 (file)
@@ -117,6 +117,9 @@ get_pam_service(Host) ->
 get_pam_userinfotype(Host) ->
     ejabberd_config:get_option({pam_userinfotype, Host}, username).
 
+-spec opt_type(pam_service) -> fun((binary()) -> binary());
+             (pam_userinfotype) -> fun((username | jid) -> username | jid);
+             (atom()) -> [atom()].
 opt_type(pam_service) -> fun iolist_to_binary/1;
 opt_type(pam_userinfotype) ->
     fun (username) -> username;
index fae75a4d24b5fa98509422f7f9293362fee5af06..9af58a080a715e56689fc4a9731954da01973756 100644 (file)
@@ -894,6 +894,16 @@ format_reason(_, _) ->
 transform_listen_option(Opt, Opts) ->
     [Opt|Opts].
 
+-type resource_conflict() :: setresource | closeold | closenew | acceptnew.
+-spec opt_type(c2s_certfile) -> fun((binary()) -> binary());
+             (c2s_ciphers) -> fun((binary()) -> binary());
+             (c2s_dhfile) -> fun((binary()) -> binary());
+             (c2s_cafile) -> fun((binary()) -> binary());
+             (c2s_protocol_options) -> fun(([binary()]) -> binary());
+             (c2s_tls_compression) -> fun((boolean()) -> boolean());
+             (resource_conflict) -> fun((resource_conflict()) -> resource_conflict());
+             (disable_sasl_mechanisms) -> fun((binary() | [binary()]) -> [binary()]);
+             (atom()) -> [atom()].
 opt_type(c2s_certfile) -> fun iolist_to_binary/1;
 opt_type(c2s_ciphers) -> fun iolist_to_binary/1;
 opt_type(c2s_dhfile) -> fun iolist_to_binary/1;
@@ -920,6 +930,23 @@ opt_type(_) ->
      c2s_protocol_options, c2s_tls_compression, resource_conflict,
      disable_sasl_mechanisms].
 
+-spec listen_opt_type(access) -> fun((any()) -> any());
+                    (shaper) -> fun((any()) -> any());
+                    (certfile) -> fun((binary()) -> binary());
+                    (ciphers) -> fun((binary()) -> binary());
+                    (dhfile) -> fun((binary()) -> binary());
+                    (cafile) -> fun((binary()) -> binary());
+                    (protocol_options) -> fun(([binary()]) -> binary());
+                    (tls_compression) -> fun((boolean()) -> boolean());
+                    (tls) -> fun((boolean()) -> boolean());
+                    (starttls) -> fun((boolean()) -> boolean());
+                    (tls_verify) -> fun((boolean()) -> boolean());
+                    (zlib) -> fun((boolean()) -> boolean());
+                    (supervisor) -> fun((boolean()) -> boolean());
+                    (max_stanza_size) -> fun((timeout()) -> timeout());
+                    (max_fsm_queue) -> fun((timeout()) -> timeout());
+                    (stream_management) -> fun((boolean()) -> boolean());
+                    (atom()) -> [atom()].
 listen_opt_type(access) -> fun acl:access_rules_validator/1;
 listen_opt_type(shaper) -> fun acl:shaper_rules_validator/1;
 listen_opt_type(certfile) -> opt_type(c2s_certfile);
@@ -935,7 +962,7 @@ listen_opt_type(tls_verify) -> fun(B) when is_boolean(B) -> B end;
 listen_opt_type(zlib) -> fun(B) when is_boolean(B) -> B end;
 listen_opt_type(supervisor) -> fun(B) when is_boolean(B) -> B end;
 listen_opt_type(max_stanza_size) ->
-    fun(I) when is_integer(I) -> I;
+    fun(I) when is_integer(I), I>0 -> I;
        (unlimited) -> infinity;
        (infinity) -> infinity
     end;
index 0a8dc0261c6b74946c9b7d68a021e3d3b2ea84ed..48e4ac1e65a6066b3feaae939381e440f17c2977 100644 (file)
@@ -528,6 +528,10 @@ clean_treap(Treap, CleanPriority) ->
 now_priority() ->
     -p1_time_compat:system_time(micro_seconds).
 
+-spec opt_type(captcha_cmd) -> fun((binary()) -> binary());
+             (captcha_host) -> fun((binary()) -> binary());
+             (captcha_limit) -> fun((pos_integer()) -> pos_integer());
+             (atom()) -> [atom()].
 opt_type(captcha_cmd) ->
     fun (FileName) ->
            F = iolist_to_binary(FileName), if F /= <<"">> -> F end
index c8822032cecf0f8d86cbd51235a69b2fd0e50c17..eccb0d621fbafcc6fe8b84d3ccaf3b26735787d0 100644 (file)
@@ -891,6 +891,9 @@ permission_addon() ->
       [{access, ejabberd_config:get_option(commands_admin_access, none)}],
       {get_exposed_commands(), []}}}].
 
+-spec opt_type(commands_admin_access) -> fun((any()) -> any());
+             (commands) -> fun((list()) -> list());
+             (atom()) -> [atom()].
 opt_type(commands_admin_access) -> fun acl:access_rules_validator/1;
 opt_type(commands) ->
     fun(V) when is_list(V) -> V end;
index 1ad76caf7dff0d41ab3fa382c0fb6fff656bc676..158ef86a7c9ffd3cd1a500dc2987db63ff83abae 100644 (file)
@@ -1362,6 +1362,23 @@ emit_deprecation_warning(Module, NewModule) ->
 now_to_seconds({MegaSecs, Secs, _MicroSecs}) ->
     MegaSecs * 1000000 + Secs.
 
+-spec opt_type(hide_sensitive_log_data) -> fun((boolean()) -> boolean());
+             (hosts) -> fun(([binary()]) -> [binary()]);
+             (language) -> fun((binary()) -> binary());
+             (max_fsm_queue) -> fun((pos_integer()) -> pos_integer());
+             (default_db) -> fun((atom()) -> atom());
+             (default_ram_db) -> fun((atom()) -> atom());
+             (loglevel) -> fun((0..5) -> 0..5);
+             (queue_dir) -> fun((binary()) -> binary());
+             (queue_type) -> fun((ram | file) -> ram | file);
+             (use_cache) -> fun((boolean()) -> boolean());
+             (cache_size) -> fun((timeout()) -> timeout());
+             (cache_missed) -> fun((boolean()) -> boolean());
+             (cache_life_time) -> fun((timeout()) -> timeout());
+             (domain_certfile) -> fun((binary()) -> binary());
+             (shared_key) -> fun((binary()) -> binary());
+             (node_start) -> fun((non_neg_integer()) -> non_neg_integer());
+             (atom()) -> [atom()].
 opt_type(hide_sensitive_log_data) ->
     fun (H) when is_boolean(H) -> H end;
 opt_type(hosts) ->
index a9643386d254bc61079f39a134d650712f898d89..87f2f87f1f3d6d333e20c546be32af3ba902575e 100644 (file)
@@ -875,6 +875,8 @@ print(Format, Args) ->
 %%    ["aaaa bbb ccc"].
 
 
+-spec opt_type(ejabberdctl_access_commands) -> fun((list()) -> list());
+             (atom()) -> [atom()].
 opt_type(ejabberdctl_access_commands) ->
     fun (V) when is_list(V) -> V end;
 opt_type(_) -> [ejabberdctl_access_commands].
index b706215a921fad35e89f0dcab2857317ecfc80a4..2dd81854e69265d126d75b8cc8f0240b3d7f3aee 100644 (file)
@@ -899,11 +899,30 @@ transform_listen_option({request_handlers, Hs}, Opts) ->
 transform_listen_option(Opt, Opts) ->
     [Opt|Opts].
 
+-spec opt_type(trusted_proxies) -> fun((all | [binary()]) -> all | [binary()]);
+             (atom()) -> [atom()].
 opt_type(trusted_proxies) ->
     fun (all) -> all;
         (TPs) -> [iolist_to_binary(TP) || TP <- TPs] end;
 opt_type(_) -> [trusted_proxies].
 
+-spec listen_opt_type(tls) -> fun((boolean()) -> boolean());
+                    (certfile) -> fun((binary()) -> binary());
+                    (ciphers) -> fun((binary()) -> binary());
+                    (dhfile) -> fun((binary()) -> binary());
+                    (protocol_options) -> fun(([binary()]) -> binary());
+                    (tls_compression) -> fun((boolean()) -> boolean());
+                    (captcha) -> fun((boolean()) -> boolean());
+                    (register) -> fun((boolean()) -> boolean());
+                    (web_admin) -> fun((boolean()) -> boolean());
+                    (http_bind) -> fun((boolean()) -> boolean());
+                    (xmlrpc) -> fun((boolean()) -> boolean());
+                    (request_handlers) -> fun(([{binary(), atom()}]) ->
+                                               [{binary(), atom()}]);
+                    (default_host) -> fun((binary()) -> binary());
+                    (custom_headers) -> fun(([{binary(), binary()}]) ->
+                                             [{binary(), binary()}]);
+                    (atom()) -> [atom()].
 listen_opt_type(tls) ->
     fun(B) when is_boolean(B) -> B end;
 listen_opt_type(certfile) ->
index 455db85a5e7255b2a0a4541f63028abe5297ebf2..af8680ef41c809cf329566aee349b1e5920ee0a9 100644 (file)
@@ -767,6 +767,14 @@ css() ->
 logo() ->
     <<"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAABACAYAAACgPErgAAAVtklEQVR42uydeXhU1d2ADzuyCcii4FZBZdEqVYtaUGqlikVwaRWsrWBRKIh8KgXcEAX9VECtoljcURAJICJWQLaKLAEjIHtBSNhC9oQkk2SW+36/52P+iIE5d5kzk4Fn3ud5H/7gIbnD3PPOveeeuVedygD9xLlQMh9yJ0D+GeokJAg1xcEWzOWYj0DBaQm0fXdaMCu8bROgpJVKksQj0+F84OXw/jRd7KVOdbbCFI6jdDNktlAnESVQNwSzOI6yhZBaV1UzAXiB4wj8CBtbqiRJXDIILtgL+zmOb8aoU5Xh0MMiEr5x6iSiAIZYROLo/aoayYMeocjbNlklSeKC9VAjBDM5IcEQfNZFnYq8AM8SkcJV6iSiCGYRkT1LVDWSA08Tkfy9MLaeOsUA2ot9xJHiW2KK+LW4Mvxnijg1/Pd9xQvFGiqJLUOhcT5kE5Etg0/VYI3TBOvbkyxYKURk2dpqDZb2gyEjC1SjUyBQdcQe4mtimujDHWXiD+Lr4g1iXZXkhISgBZBLZIaoU5GR0I2IVDxxkgVrNhH5z+pqDZb2g+FAJjQ4aYMFtBAfEzdils3iP8TkhYkqlMEZFuQQmcHqVGUBTOI40lLhz02TwUoGKxJAI/FxMYPYckB8Smyikvw/vlM/WHqAP4ifiHPF0fBsYyUkg5UM1okAbhV/JL5sE29TSZLBOhHJYCWDVRXgNPFVqpfXxQbJYCWDlQxWMlgRAc4VV5EYrBZ/kQxWMljJYFVLsBomdLCAS8RdJBZ7xMuSwTIcLKCO2EG8VrxdvEfsLV4F1vkJstq9BlidwN8hVleSLLgUuFzsEv6zs9g4EYIFNBAvFi87tm3WZWI7oHZ8glWnkWbb6ortCG/bsT+tDsBpcYrVpeI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3WhJX1SKSTpzcN60J1udKQNfdOIaiFJLwxrTwua0Zj61PtjXfqgDtWpEJL04rCetKKBM5GUeVgnGoYkJR1Wka60o0ZIUuJhVWlLzZCk5MMqUyv0r/wCSDD/4sxS1q8AAAAASUVORK5CYII=">>.
 
+-spec opt_type(oauth_expire) -> fun((non_neg_integer()) -> non_neg_integer());
+             (oauth_access) -> fun((any()) -> any());
+             (oauth_db_type) -> fun((atom()) -> atom());
+             (oauth_cache_life_time) -> fun((timeout()) -> timeout());
+             (oauth_cache_size) -> fun((timeout()) -> timeout());
+             (oauth_use_cache) -> fun((boolean()) -> boolean());
+             (oauth_cache_misse) -> fun((boolean()) -> boolean());
+             (atom()) -> [atom()].
 opt_type(oauth_expire) ->
     fun(I) when is_integer(I), I >= 0 -> I end;
 opt_type(oauth_access) ->
index 6c5b3052315eab7da21c11f21ac6d52e616f98d8..404edd1fd5072238c5b6bf2d6caf52f5c4338508 100644 (file)
@@ -93,6 +93,8 @@ path(Path) ->
     <<Base/binary, "/", Path/binary>>.
 
 
+-spec opt_type(ext_api_path_oauth) -> fun((binary()) -> binary());
+             (atom()) -> [atom()].
 opt_type(ext_api_path_oauth) ->
     fun (X) -> iolist_to_binary(X) end;
 opt_type(_) -> [ext_api_path_oauth].
index 7021c10b741b13645f0406d4159b484328fbfad5..14bd968d26d5639fbae32d409c89724b6ee4ca25 100644 (file)
@@ -109,6 +109,9 @@ needs_sql(Host) ->
         undefined -> false
     end.
 
+-type sql_type() :: mysql | pgsql | sqlite | mssql | odbc.
+-spec opt_type(sql_type) -> fun((sql_type()) -> sql_type());
+             (atom()) -> [atom()].
 opt_type(sql_type) ->
     fun (mysql) -> mysql;
        (pgsql) -> pgsql;
index 38ad70eb33ca8ad7ca430966f21cd382bb35e292..24eb92fadc7b914e77c67bd7667591dbc7912d7b 100644 (file)
@@ -348,6 +348,9 @@ do_call(Pid, Msg) ->
 hibernate_timeout() ->
     ejabberd_config:get_option(receiver_hibernate, timer:seconds(90)).
 
+-spec opt_type(receiver_hibernate) -> fun((pos_integer() | hibernate) ->
+                                          pos_integer() | hibernate);
+             (atom()) -> [atom()].
 opt_type(receiver_hibernate) ->
     fun(I) when is_integer(I), I>0 -> I;
        (hibernate) -> hibernate
index 85cfd7abbe91239cbf1acce984298073be419b79..ff1cc0e12b08820c41c0c2d639d532230e00fb52 100644 (file)
@@ -133,6 +133,14 @@ get_pool_size() ->
 iolist_to_list(IOList) ->
     binary_to_list(iolist_to_binary(IOList)).
 
+-spec opt_type(redis_connect_timeout) -> fun((pos_integer()) -> pos_integer());
+             (redis_db) -> fun((non_neg_integer()) -> non_neg_integer());
+             (redis_password) -> fun((binary()) -> binary());
+             (redis_port) -> fun((0..65535) -> 0..65535);
+             (redis_server) -> fun((binary()) -> binary());
+             (redis_pool_size) -> fun((pos_integer()) -> pos_integer());
+             (redis_queue_type) -> fun((ram | file) -> ram | file);
+             (atom()) -> [atom()].
 opt_type(redis_connect_timeout) ->
     fun (I) when is_integer(I), I > 0 -> I end;
 opt_type(redis_db) ->
index 3d754f6d6e218e57d4d6ee45d58fba172d4b6b6b..30be65c4fd7ad5864604cedf83c6489512ebff7c 100644 (file)
@@ -179,6 +179,14 @@ transform_options({riak_server, {S, P}}, Opts) ->
 transform_options(Opt, Opts) ->
     [Opt|Opts].
 
+-spec opt_type(riak_pool_size) -> fun((pos_integer()) -> pos_integer());
+             (riak_port) -> fun((0..65535) -> 0..65535);
+             (riak_server) -> fun((binary()) -> binary());
+             (riak_start_interval) -> fun((pos_integer()) -> pos_integer());
+             (riak_cacertfile) -> fun((binary()) -> binary());
+             (riak_username) -> fun((binary()) -> binary());
+             (riak_password) -> fun((binary()) -> binary());
+             (atom()) -> [atom()].
 opt_type(riak_pool_size) ->
     fun (N) when is_integer(N), N >= 1 -> N end;
 opt_type(riak_port) ->
index 490133d792b3f9143dc3f643b958eab673d418a5..8446513299eb56b5f16a167682fc67fbb8d9b117 100644 (file)
@@ -476,6 +476,16 @@ clean_cache(Node) ->
 clean_cache() ->
     ejabberd_cluster:eval_everywhere(?MODULE, clean_cache, [node()]).
 
+-type domain_balancing() :: random | source | destination |
+                           bare_source | bare_destination.
+-spec opt_type(domain_balancing) -> fun((domain_balancing()) -> domain_balancing());
+             (domain_balancing_component_number) -> fun((pos_integer()) -> pos_integer());
+             (router_db_type) -> fun((atom()) -> atom());
+             (router_use_cache) -> fun((boolean()) -> boolean());
+             (router_cache_missed) -> fun((boolean()) -> boolean());
+             (router_cache_size) -> fun((timeout()) -> timeout());
+             (router_cache_life_time) -> fun((timeout()) -> timeout());
+             (atom()) -> [atom()].
 opt_type(domain_balancing) ->
     fun (random) -> random;
        (source) -> source;
index b6685c12eb5eb3d032b6672ef926930bb18acd74..a447dcd67c33175ad2a319ee13baf14ed049da40 100644 (file)
@@ -689,6 +689,20 @@ get_s2s_state(S2sPid) ->
            end,
     [{s2s_pid, S2sPid} | Infos].
 
+-type use_starttls() :: boolean() | optional | required | required_trusted.
+-spec opt_type(route_subdomains) -> fun((s2s | local) -> s2s | local);
+             (s2s_access) -> fun((any()) -> any());
+             (s2s_certfile) -> fun((binary()) -> binary());
+             (s2s_ciphers) -> fun((binary()) -> binary());
+             (s2s_dhfile) -> fun((binary()) -> binary());
+             (s2s_cafile) -> fun((binary()) -> binary());
+             (s2s_protocol_options) -> fun(([binary()]) -> binary());
+             (s2s_tls_compression) -> fun((boolean()) -> boolean());
+             (s2s_use_starttls) -> fun((use_starttls()) -> use_starttls());
+             (s2s_zlib) -> fun((boolean()) -> boolean());
+             (s2s_timeout) -> fun((timeout()) -> timeout());
+             (s2s_queue_type) -> fun((ram | file) -> ram | file);
+             (atom()) -> [atom()].
 opt_type(route_subdomains) ->
     fun (s2s) -> s2s;
        (local) -> local
index b1d0ae215a1d3a6bbe7e369fbffb7a34c260798f..90e0feb27c311913e37245d4ac7ccea9458ca36b 100644 (file)
 %%%-------------------------------------------------------------------
 -module(ejabberd_s2s_in).
 -behaviour(xmpp_stream_in).
--behaviour(ejabberd_config).
 -behaviour(ejabberd_socket).
 
 %% ejabberd_socket callbacks
 -export([start/2, start_link/2, socket_type/0]).
-%% ejabberd_config callbacks
--export([opt_type/1, listen_opt_type/1]).
+%% ejabberd_listener callbacks
+-export([listen_opt_type/1]).
 %% xmpp_stream_in callbacks
 -export([init/1, handle_call/3, handle_cast/2,
         handle_info/2, terminate/2, code_change/3]).
@@ -344,9 +343,18 @@ change_shaper(#{shaper := ShaperName, server_host := ServerHost} = State,
     Shaper = acl:match_rule(ServerHost, ShaperName, jid:make(RServer)),
     xmpp_stream_in:change_shaper(State, Shaper).
 
-opt_type(_) ->
-    [].
-
+-spec listen_opt_type(shaper) -> fun((any()) -> any());
+                    (certfile) -> fun((binary()) -> binary());
+                    (ciphers) -> fun((binary()) -> binary());
+                    (dhfile) -> fun((binary()) -> binary());
+                    (cafile) -> fun((binary()) -> binary());
+                    (protocol_options) -> fun(([binary()]) -> binary());
+                    (tls_compression) -> fun((boolean()) -> boolean());
+                    (tls) -> fun((boolean()) -> boolean());
+                    (supervisor) -> fun((boolean()) -> boolean());
+                    (max_stanza_type) -> fun((timeout()) -> timeout());
+                    (max_fsm_queue) -> fun((pos_integer()) -> pos_integer());
+                    (atom()) -> [atom()].
 listen_opt_type(shaper) -> fun acl:shaper_rules_validator/1;
 listen_opt_type(certfile) -> ejabberd_s2s:opt_type(s2s_certfile);
 listen_opt_type(ciphers) -> ejabberd_s2s:opt_type(s2s_ciphers);
@@ -357,7 +365,7 @@ listen_opt_type(tls_compression) -> ejabberd_s2s:opt_type(s2s_tls_compression);
 listen_opt_type(tls) -> fun(B) when is_boolean(B) -> B end;
 listen_opt_type(supervisor) -> fun(B) when is_boolean(B) -> B end;
 listen_opt_type(max_stanza_size) ->
-    fun(I) when is_integer(I) -> I;
+    fun(I) when is_integer(I), I>0 -> I;
        (unlimited) -> infinity;
        (infinity) -> infinity
     end;
index deff3e5b569c5efa0565acfa518c75d3db6e7575..bcacd8e77bb63f17b2c8855576d58ebaab54bf2e 100644 (file)
@@ -439,6 +439,13 @@ maybe_report_huge_timeout(Opt, T) when is_integer(T), T >= 1000 ->
 maybe_report_huge_timeout(_, _) ->
     ok.
 
+-spec opt_type(outgoing_s2s_families) -> fun(([ipv4|ipv6]) -> [inet|inet6]);
+             (outgoing_s2s_port) -> fun((0..65535) -> 0..65535);
+             (outgoing_s2s_timeout) -> fun((timeout()) -> timeout());
+             (s2s_dns_retries) -> fun((non_neg_integer()) -> non_neg_integer());
+             (s2s_dns_timeout) -> fun((timeout()) -> timeout());
+             (s2s_max_retry_delay) -> fun((pos_integer()) -> pos_integer());
+             (atom()) -> [atom()].
 opt_type(outgoing_s2s_families) ->
     fun(Families) ->
            lists:map(
@@ -447,7 +454,7 @@ opt_type(outgoing_s2s_families) ->
              end, Families)
     end;
 opt_type(outgoing_s2s_port) ->
-    fun (I) when is_integer(I), I > 0, I =< 65536 -> I end;
+    fun (I) when is_integer(I), I > 0, I < 65536 -> I end;
 opt_type(outgoing_s2s_timeout) ->
     fun(TimeOut) when is_integer(TimeOut), TimeOut > 0 ->
            timer:seconds(TimeOut);
index 0dcf74ab08defd50487a577808c7bcb5cca5d55a..6fae16940c98ebbf18a495cdf47f8492d78b1058 100644 (file)
 %%%-------------------------------------------------------------------
 -module(ejabberd_service).
 -behaviour(xmpp_stream_in).
--behaviour(ejabberd_config).
 -behaviour(ejabberd_socket).
 
 -protocol({xep, 114, '1.6'}).
 
 %% ejabberd_socket callbacks
 -export([start/2, start_link/2, socket_type/0, close/1, close/2]).
-%% ejabberd_config callbacks
--export([opt_type/1, listen_opt_type/1, transform_listen_option/2]).
+%% ejabberd_listener callbacks
+-export([listen_opt_type/1, transform_listen_option/2]).
 %% xmpp_stream_in callbacks
 -export([init/1, handle_info/2, terminate/2, code_change/3]).
 -export([handle_stream_start/2, handle_auth_success/4, handle_auth_failure/4,
@@ -259,8 +258,22 @@ transform_listen_option({host, Host, Os}, Opts) ->
 transform_listen_option(Opt, Opts) ->
     [Opt|Opts].
 
-opt_type(_) -> [].
-
+-spec listen_opt_type(access) -> fun((any()) -> any());
+                    (shaper_rule) -> fun((any()) -> any());
+                    (certfile) -> fun((binary()) -> binary());
+                    (ciphers) -> fun((binary()) -> binary());
+                    (dhfile) -> fun((binary()) -> binary());
+                    (cafile) -> fun((binary()) -> binary());
+                    (protocol_options) -> fun(([binary()]) -> binary());
+                    (tls_compression) -> fun((boolean()) -> boolean());
+                    (tls) -> fun((boolean()) -> boolean());
+                    (check_from) -> fun((boolean()) -> boolean());
+                    (password) -> fun((boolean()) -> boolean());
+                    (hosts) -> fun(([{binary(), [{password, binary()}]}]) ->
+                                    [{binary(), binary() | undefined}]);
+                    (max_stanza_type) -> fun((timeout()) -> timeout());
+                    (max_fsm_queue) -> fun((pos_integer()) -> pos_integer());
+                    (atom()) -> [atom()].
 listen_opt_type(access) -> fun acl:access_rules_validator/1;
 listen_opt_type(shaper_rule) -> fun acl:shaper_rules_validator/1;
 listen_opt_type(certfile) -> fun iolist_to_binary/1;
index ce2abfff0620b0fd2806537fe727e4e1abdbc6a0..92c6bb94fb3061b77400a6b58870cb7d9b645eec 100644 (file)
@@ -1010,6 +1010,12 @@ kick_user(User, Server) ->
 make_sid() ->
     {p1_time_compat:unique_timestamp(), self()}.
 
+-spec opt_type(sm_db_type) -> fun((atom()) -> atom());
+             (sm_use_cache) -> fun((boolean()) -> boolean());
+             (sm_cache_missed) -> fun((boolean()) -> boolean());
+             (sm_cache_size) -> fun((timeout()) -> timeout());
+             (sm_cache_life_time) -> fun((timeout()) -> timeout());
+             (atom()) -> [atom()].
 opt_type(sm_db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
 opt_type(O) when O == sm_use_cache; O == sm_cache_missed ->
     fun(B) when is_boolean(B) -> B end;
index 4c85b874ae915f84e4050bba07e2e2bf12fa9574..dc6292ce49efb5b30519e350047b15ad79831e60 100644 (file)
@@ -1080,6 +1080,20 @@ check_error({error, Why} = Err, Query) ->
 check_error(Result, _Query) ->
     Result.
 
+-spec opt_type(sql_database) -> fun((binary()) -> binary());
+             (sql_keepalive_interval) -> fun((pos_integer()) -> pos_integer());
+             (sql_password) -> fun((binary()) -> binary());
+             (sql_port) -> fun((0..65535) -> 0..65535);
+             (sql_server) -> fun((binary()) -> binary());
+             (sql_username) -> fun((binary()) -> binary());
+             (sql_ssl) -> fun((boolean()) -> boolean());
+             (sql_ssl_verify) -> fun((boolean()) -> boolean());
+             (sql_ssl_certfile) -> fun((boolean()) -> boolean());
+             (sql_ssl_cafile) -> fun((boolean()) -> boolean());
+             (sql_query_timeout) -> fun((pos_integer()) -> pos_integer());
+             (sql_connect_timeout) -> fun((pos_integer()) -> pos_integer());
+             (sql_queue_type) -> fun((ram | file) -> ram | file);
+             (atom()) -> [atom()].
 opt_type(sql_database) -> fun iolist_to_binary/1;
 opt_type(sql_keepalive_interval) ->
     fun (I) when is_integer(I), I > 0 -> I end;
index 7526aedbe4152f9607d9c56ecf0bdd58346be0d4..f7793eb2ce5bd2371772908913b5b87f5913a3b5 100644 (file)
@@ -218,6 +218,9 @@ read_lines(Fd, File, Acc) ->
             []
     end.
 
+-spec opt_type(sql_pool_size) -> fun((pos_integer()) -> pos_integer());
+             (sql_start_interval) -> fun((pos_integer()) -> pos_integer());
+             (atom()) -> [atom()].
 opt_type(sql_pool_size) ->
     fun (I) when is_integer(I), I > 0 -> I end;
 opt_type(sql_start_interval) ->
index 881bfa635967ca73a5e4dc34ce5abdd3a2bacc6a..773104f9ebc7be34e794882a6988597156449dfb 100644 (file)
@@ -330,6 +330,9 @@ process_remote_command([setlh, NewValue]) ->
                  [OldLH, NewLH]);
 process_remote_command(_) -> throw(unknown_command).
 
+-spec opt_type(watchdog_admins) -> fun(([binary()]) -> ljid());
+             (watchdog_large_heap) -> fun((pos_integer()) -> pos_integer());
+             (atom()) -> [atom()].
 opt_type(watchdog_admins) ->
     fun (JIDs) ->
            [jid:tolower(jid:decode(iolist_to_binary(S)))
index 0106bb9cd0141362ebb19f0ab0c8b3eb0be3e681..5050ac0954e625843f5aac4fcb48108359760fde 100644 (file)
@@ -2981,6 +2981,8 @@ make_menu_item(item, 3, URI, Name, Lang) ->
 %%%==================================
 
 
+-spec opt_type(access_readonly) -> fun((any()) -> any());
+             (atom()) -> [atom()].
 opt_type(access_readonly) -> fun acl:access_rules_validator/1;
 opt_type(_) -> [access_readonly].
 
index d15e5bc9c63c3db6e760e38fd155826fb8bfa9c6..52671061d716b3f4239af0dfa3c2710afa2e3165 100644 (file)
@@ -318,12 +318,25 @@ collect_parts_bit([{?N_BIT_STRING,<<Unused,Bits/binary>>}|Rest],Acc,Uacc) ->
 collect_parts_bit([],Acc,Uacc) ->
     list_to_binary([Uacc|lists:reverse(Acc)]).
 
+-type deref_aliases() :: never | searching | finding | always.
+-type uids() :: binary() | {binary()} | {binary(), binary()}.
+-spec opt_type(deref_aliases) -> fun((deref_aliases()) -> deref_aliases());
+             (ldap_backups) -> fun(([binary()]) -> [binary()]);
+             (ldap_base) -> fun((binary()) -> binary());
+             (ldap_deref_aliases) -> fun((deref_aliases()) -> deref_aliases());
+             (ldap_encrypt) -> fun((tls | starttls | none) -> tls | starttls | none);
+             (ldap_password) -> fun((binary()) -> binary());
+             (ldap_port) -> fun((0..65535) -> 0..65535);
+             (ldap_rootdn) -> fun((binary()) -> binary());
+             (ldap_servers) -> fun(([binary()]) -> [binary()]);
+             (ldap_tls_certfile) -> fun((binary()) -> string());
+             (ldap_tls_depth) -> fun((non_neg_integer()) -> non_neg_integer());
+             (ldap_tls_verify) -> fun((hard | soft | false) -> hard | soft | false);
+             (ldap_filter) -> fun((binary()) -> binary());
+             (ldap_uids) -> fun((uids()) -> uids());
+             (atom()) -> [atom()].
 opt_type(deref_aliases) ->
-    fun (never) -> never;
-       (searching) -> searching;
-       (finding) -> finding;
-       (always) -> always
-    end;
+    opt_type(ldap_deref_aliases);
 opt_type(ldap_backups) ->
     fun (L) -> [iolist_to_binary(H) || H <- L] end;
 opt_type(ldap_base) -> fun iolist_to_binary/1;
index 15fe8e17f32182c01c12e9ed052cc0229b6726d1..c5ce6874f0eb9d93880b85070091f66c58ecb512 100644 (file)
@@ -652,6 +652,8 @@ format({Key, Val}) when is_binary(Val) ->
 format({Key, Val}) -> % TODO: improve Yaml parsing
     {Key, Val}.
 
+-spec opt_type(allow_contrib_modules) -> fun((boolean()) -> boolean());
+             (atom()) -> [atom()].
 opt_type(allow_contrib_modules) ->
     fun (false) -> false;
         (no) -> false;
index c6f25102cbcb7cae16edd7e4dfcc91545b5cdd02..54f44953c60edddfd627839d1d8da72fe867324c 100644 (file)
@@ -154,6 +154,8 @@ encode(L) -> str:join(L, <<":">>).
 decode([0, 0]) -> false;
 decode([0, 1]) -> true.
 
+-spec opt_type(extauth_instances) -> fun((pos_integer()) -> pos_integer());
+             (atom()) -> [atom()].
 opt_type(extauth_instances) ->
     fun (V) when is_integer(V), V > 0 -> V end;
 opt_type(_) -> [extauth_instances].
index aaa7861dc5e9feb59e6a28a7268efa899d79d09a..6ca706f63aff527e06a42fee9e532446cd94c59b 100644 (file)
@@ -198,6 +198,8 @@ transform_module_options(Opts) ->
               Opt
       end, Opts).
 
+-spec opt_type(iqdisc) -> fun((type()) -> type());
+             (atom()) -> [atom()].
 opt_type(iqdisc) -> fun check_type/1;
 opt_type(_) -> [iqdisc].
 
index fdfd94f2a93c33e13ecda42e54595e871b8208a1..27d241c9c19a69e70d5e6938aa65a7da262652da 100644 (file)
@@ -677,6 +677,8 @@ is_equal_opt(Opt, NewOpts, OldOpts, Default) ->
            true
     end.
 
+-spec opt_type(modules) -> fun(([{atom(), list()}]) -> [{atom(), list()}]);
+             (atom()) -> [atom()].
 opt_type(modules) ->
     fun(Mods) ->
            lists:map(
index 9a3adc2d7b3b8c34645754cf96221fdba3cf7891..ecae7cd1b3abd74b868c51366b00700f5310e22c 100644 (file)
@@ -25,7 +25,6 @@
 
 -module(mod_metrics).
 
--behaviour(ejabberd_config).
 -author('christophe.romain@process-one.net').
 -behaviour(gen_mod).
 
@@ -33,7 +32,7 @@
 -include("logger.hrl").
 -include("xmpp.hrl").
 
--export([start/2, stop/1, send_metrics/4, opt_type/1, mod_opt_type/1,
+-export([start/2, stop/1, send_metrics/4, mod_opt_type/1,
         depends/2, reload/3]).
 
 -export([offline_message_hook/1,
@@ -157,8 +156,5 @@ send_metrics(Host, Probe, Peer, Port) ->
            ?WARNING_MSG("can not open udp socket to grapherl: ~p", [Error])
     end.
 
-opt_type(_) ->
-     [].
-
 mod_opt_type(_) ->
     [].
index 893a16c7a7c8a6543d818cd01b200da4efec7dce..af4ba02f4d75ebab9bd7707928bf231faf410fa1 100644 (file)
@@ -612,6 +612,8 @@ mod_opt_type(_) ->
      iqdisc, password_strength, registration_watchers,
      {welcome_message, subject}, {welcome_message, body}].
 
+-spec opt_type(registration_timeout) -> fun((timeout()) -> timeout());
+             (atom()) -> [atom()].
 opt_type(registration_timeout) ->
     fun (TO) when is_integer(TO), TO > 0 -> TO;
        (infinity) -> infinity;
index 28dda7af6c42bde3535c4580a6447d43b11ec37c..f97eb18a9038a457ec2e2da0085c1af24a095866 100644 (file)
@@ -24,8 +24,6 @@
 
 -module(mod_vcard_ldap).
 
--behaviour(ejabberd_config).
-
 -behaviour(gen_server).
 -behaviour(mod_vcard).
 
@@ -33,7 +31,7 @@
 -export([start_link/2]).
 -export([init/2, stop/1, get_vcard/2, set_vcard/4, search/4,
         remove_user/2, import/3, search_fields/1, search_reported/1,
-        mod_opt_type/1, opt_type/1]).
+        mod_opt_type/1]).
 -export([is_search_supported/1]).
 
 %% gen_server callbacks
@@ -487,10 +485,3 @@ mod_opt_type(_) ->
      ldap_port, ldap_rootdn, ldap_servers,
      ldap_tls_cacertfile, ldap_tls_certfile, ldap_tls_depth,
      ldap_tls_verify].
-
-opt_type(_) ->
-    [deref_aliases, ldap_backups, ldap_base,
-     ldap_deref_aliases, ldap_encrypt, ldap_password,
-     ldap_port, ldap_rootdn, ldap_servers,
-     ldap_tls_cacertfile, ldap_tls_certfile, ldap_tls_depth,
-     ldap_tls_verify].
index a3fb0eef23b3c3c40caa6732b6c26a0e175c5eb9..833a498ed9de0fc02ea2b452b40d2fc9d1c93d35 100644 (file)
@@ -177,6 +177,9 @@ url(Server, Path, Params) ->
     Tail = iolist_to_binary([ParHead | ParTail]),
     binary_to_list(<<Base/binary, $?, Tail/binary>>).
 
+-spec opt_type(ext_api_http_pool_size) -> fun((pos_integer()) -> pos_integer());
+             (ext_api_url) -> fun((binary()) -> binary());
+             (atom()) -> [atom()].
 opt_type(ext_api_http_pool_size) ->
     fun (X) when is_integer(X), X > 0 -> X end;
 opt_type(ext_api_url) ->
index ac1ecc36f6f1348f42dde85135b8ece0a87b214d..803d235a0237af3024e1d94d91771ff4a13ff209 100644 (file)
@@ -168,5 +168,7 @@ transform_options({OptName, Name, none}, Opts) when OptName == shaper ->
 transform_options(Opt, Opts) ->
     [Opt|Opts].
 
+-spec opt_type(shaper) -> fun((any()) -> any());
+             (atom()) -> [atom()].
 opt_type(shaper) -> fun (V) -> V end;
 opt_type(_) -> [shaper].
index 5d57291029491bbb227e3db7c1b8d2c306f250db..83cbd7b73ebf14d2973fd81df9585bb512d539dd 100644 (file)
@@ -632,6 +632,8 @@ set_roster_version(LUser, Version) ->
        ["!username=%(LUser)s",
         "version=%(Version)s"]).
 
+-spec opt_type(pgsql_users_number_estimate) -> fun((boolean()) -> boolean());
+             (atom()) -> [atom()].
 opt_type(pgsql_users_number_estimate) ->
     fun (V) when is_boolean(V) -> V end;
 opt_type(_) -> [pgsql_users_number_estimate].