diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-05-05 11:11:17 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-05-05 11:11:17 +0300 |
commit | b174e2c9c6177e3bdac8edaa8f60d861a2631933 (patch) | |
tree | 2876909e33266808fb7409b11b6686823beaaa82 /src/mod_register.erl | |
parent | Make it possible to validate second-level options (diff) |
Improve validation of second-level options
Diffstat (limited to 'src/mod_register.erl')
-rw-r--r-- | src/mod_register.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mod_register.erl b/src/mod_register.erl index 1c4de130..893a16c7 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -599,15 +599,18 @@ mod_opt_type(registration_watchers) -> [jid:decode(iolist_to_binary(S)) || S <- Ss] end; mod_opt_type(welcome_message) -> - fun (Opts) -> - S = proplists:get_value(subject, Opts, <<>>), - B = proplists:get_value(body, Opts, <<>>), - {iolist_to_binary(S), iolist_to_binary(B)} + fun(L) -> + {proplists:get_value(subject, L, <<"">>), + proplists:get_value(body, L, <<"">>)} end; +mod_opt_type({welcome_message, subject}) -> + fun iolist_to_binary/1; +mod_opt_type({welcome_message, body}) -> + fun iolist_to_binary/1; mod_opt_type(_) -> [access, access_from, captcha_protected, ip_access, iqdisc, password_strength, registration_watchers, - welcome_message]. + {welcome_message, subject}, {welcome_message, body}]. opt_type(registration_timeout) -> fun (TO) when is_integer(TO), TO > 0 -> TO; |