summaryrefslogtreecommitdiff
path: root/src/mod_register.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-05-05 11:11:17 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-05-05 11:11:17 +0300
commitb174e2c9c6177e3bdac8edaa8f60d861a2631933 (patch)
tree2876909e33266808fb7409b11b6686823beaaa82 /src/mod_register.erl
parentMake 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.erl13
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;