diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-05-08 12:59:28 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-05-08 12:59:28 +0300 |
commit | 01a2c9fe1202f88f20a5acbc729b627ce0ac3c0a (patch) | |
tree | 4aba0e94650d1311ab5b2da0e74563b1bd02a876 /src/ejabberd_c2s.erl | |
parent | LOG_PATH macro should be of string type (diff) |
Add type specs for Module:opt_type/1
Diffstat (limited to 'src/ejabberd_c2s.erl')
-rw-r--r-- | src/ejabberd_c2s.erl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index fae75a4d2..9af58a080 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -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; |