* src/mod_muc/mod_muc.erl: Bugfix

SVN Revision: 764
This commit is contained in:
Alexey Shchepin 2007-05-09 14:47:58 +00:00
parent 396b945d20
commit 737bb8888a
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2007-05-09 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc.erl: Bugfix
2007-05-07 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_receiver.erl: Workaround for inet_drv bug

View File

@ -146,9 +146,9 @@ init([Host, Opts]) ->
[{ram_copies, [node()]},
{attributes, record_info(fields, muc_online_room)}]),
mnesia:add_table_copy(muc_online_room, node(), ram_copies),
clean_table_from_bad_node(node()),
MyHost = gen_mod:get_opt(host, Opts, "conference." ++ Host),
update_tables(MyHost),
clean_table_from_bad_node(node(), MyHost),
mnesia:add_table_index(muc_registered, nick),
mnesia:subscribe(system),
Access = gen_mod:get_opt(access, Opts, all),
@ -642,6 +642,21 @@ clean_table_from_bad_node(Node) ->
end,
mnesia:transaction(F).
clean_table_from_bad_node(Node, Host) ->
F = fun() ->
Es = mnesia:select(
muc_online_room,
[{#muc_online_room{pid = '$1',
name_host = {'_', Host},
_ = '_'},
[{'==', {node, '$1'}, Node}],
['$_']}]),
lists:foreach(fun(E) ->
mnesia:delete_object(E)
end, Es)
end,
mnesia:transaction(F).
update_tables(Host) ->
update_muc_room_table(Host),