Update mod_default_rooms option parsing to use econf

This commit is contained in:
Badlop 2022-08-12 17:53:22 +02:00
parent f3e03b9729
commit 12e31364f6
2 changed files with 5 additions and 6 deletions

View File

@ -20,11 +20,10 @@ following:
```yaml
modules:
# [...]
mod_default_rooms:
rooms:
- "foo@conference.example.net"
- "bar@conference.example.org"
- foo@conference.example.net
- bar@conference.example.org
```
The configurable `mod_default_rooms` options are:

View File

@ -52,11 +52,11 @@ stop(Host) ->
reload(_Host, _NewOpts, _OldOpts) ->
ok.
-spec mod_opt_type(atom()) -> fun((term()) -> term()).
-spec mod_opt_type(atom()) -> econf:validator().
mod_opt_type(auto_join) ->
fun (B) when is_boolean(B) -> B end;
econf:bool();
mod_opt_type(rooms) ->
fun (Rs) -> [jid:decode(iolist_to_binary(R)) || R <- Rs] end.
econf:list(econf:jid(), [unique]).
-spec mod_options(binary()) -> [{atom(), any()}].
mod_options(_Host) ->