aboutsummaryrefslogtreecommitdiff
path: root/src/mod_muc_mnesia.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-08-08 17:46:26 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-08-08 17:46:26 +0300
commit3fec782494042ab1e1a015524e01cd63e6757c7e (patch)
tree55be45f1d6861e5e8de6c33648a447d87e27eb4c /src/mod_muc_mnesia.erl
parentFix tests for 8679cfd2f (diff)
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
Diffstat (limited to 'src/mod_muc_mnesia.erl')
-rw-r--r--src/mod_muc_mnesia.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mod_muc_mnesia.erl b/src/mod_muc_mnesia.erl
index 53f31cb9f..015c5ec43 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