From 3fec782494042ab1e1a015524e01cd63e6757c7e Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Tue, 8 Aug 2017 17:46:26 +0300 Subject: Introduce 'hosts' option The option can be used as a replacement of 'host' option when several (sub)domains are needed to be registered for the module. Note that you cannot combine both 'host' and 'hosts' in the config because 'host' option is of a higher priority. Example: mod_pubsub: ... hosts: - "pubsub1.@HOST@" - "pubsub2.@HOST@" Fixes #1883 --- src/mod_muc_mnesia.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mod_muc_mnesia.erl') diff --git a/src/mod_muc_mnesia.erl b/src/mod_muc_mnesia.erl index 53f31cb9..015c5ec4 100644 --- a/src/mod_muc_mnesia.erl +++ b/src/mod_muc_mnesia.erl @@ -296,7 +296,7 @@ import(_LServer, <<"muc_registered">>, %%% gen_server callbacks %%%=================================================================== init([Host, Opts]) -> - MyHost = proplists:get_value(host, Opts), + MyHosts = proplists:get_value(hosts, Opts), case gen_mod:db_mod(Host, Opts, mod_muc) of ?MODULE -> ejabberd_mnesia:create(?MODULE, muc_room, @@ -318,7 +318,10 @@ init([Host, Opts]) -> {type, ordered_set}, {attributes, record_info(fields, muc_online_room)}]), catch ets:new(muc_online_users, [bag, named_table, public, {keypos, 2}]), - clean_table_from_bad_node(node(), MyHost), + lists:foreach( + fun(MyHost) -> + clean_table_from_bad_node(node(), MyHost) + end, MyHosts), mnesia:subscribe(system); _ -> ok -- cgit v1.2.3