From 12e31364f602dc05fce895bd0b8c10f9f2ee0ef2 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 12 Aug 2022 17:53:22 +0200 Subject: [PATCH] Update mod_default_rooms option parsing to use econf --- mod_default_rooms/README.md | 5 ++--- mod_default_rooms/src/mod_default_rooms.erl | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mod_default_rooms/README.md b/mod_default_rooms/README.md index e42fd36..13b8b19 100644 --- a/mod_default_rooms/README.md +++ b/mod_default_rooms/README.md @@ -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: diff --git a/mod_default_rooms/src/mod_default_rooms.erl b/mod_default_rooms/src/mod_default_rooms.erl index 5b4fde2..01ee187 100644 --- a/mod_default_rooms/src/mod_default_rooms.erl +++ b/mod_default_rooms/src/mod_default_rooms.erl @@ -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) ->