26
1
mirror of https://github.com/processone/ejabberd.git synced 2025-01-01 17:53:00 +01:00

* src/mod_muc/mod_muc.erl: Clean online room table on cluster node

restart

SVN Revision: 724
This commit is contained in:
Alexey Shchepin 2007-02-13 17:23:36 +00:00
parent 1e03821f39
commit 3c44f24aad
2 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-02-13 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc.erl: Clean online room table on cluster node
restart
2007-02-13 Mickael Remond <mickael.remond@process-one.net> 2007-02-13 Mickael Remond <mickael.remond@process-one.net>
* src/ejabberd_auth_ldap.erl: Added ldap_local_filter option. This * src/ejabberd_auth_ldap.erl: Added ldap_local_filter option. This

View File

@ -149,6 +149,7 @@ init([Host, Opts]) ->
MyHost = gen_mod:get_opt(host, Opts, "conference." ++ Host), MyHost = gen_mod:get_opt(host, Opts, "conference." ++ Host),
update_tables(MyHost), update_tables(MyHost),
mnesia:add_table_index(muc_registered, nick), mnesia:add_table_index(muc_registered, nick),
mnesia:subscribe(system),
Access = gen_mod:get_opt(access, Opts, all), Access = gen_mod:get_opt(access, Opts, all),
AccessCreate = gen_mod:get_opt(access_create, Opts, all), AccessCreate = gen_mod:get_opt(access_create, Opts, all),
AccessAdmin = gen_mod:get_opt(access_admin, Opts, none), AccessAdmin = gen_mod:get_opt(access_admin, Opts, none),
@ -207,6 +208,9 @@ handle_info({room_destroyed, RoomHost, Pid}, State) ->
end, end,
mnesia:transaction(F), mnesia:transaction(F),
{noreply, State}; {noreply, State};
handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
clean_table_from_bad_node(Node),
{noreply, State};
handle_info(_Info, State) -> handle_info(_Info, State) ->
{noreply, State}. {noreply, State}.
@ -616,6 +620,19 @@ get_vh_rooms(Host) ->
['$_']}]). ['$_']}]).
clean_table_from_bad_node(Node) ->
F = fun() ->
Es = mnesia:select(
muc_online_room,
[{#muc_online_room{pid = '$1', _ = '_'},
[{'==', {node, '$1'}, Node}],
['$_']}]),
lists:foreach(fun(E) ->
mnesia:delete_object(E)
end, Es)
end,
mnesia:transaction(F).
update_tables(Host) -> update_tables(Host) ->
update_muc_room_table(Host), update_muc_room_table(Host),