diff options
author | Alexey Shchepin <alexey@process-one.net> | 2007-05-09 14:47:58 +0000 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2007-05-09 14:47:58 +0000 |
commit | 737bb8888ae340ecf89bf0e8a47fcdbbd70713a3 (patch) | |
tree | 99269436efb0cba752ac894e31ae867c8730fa60 /src/mod_muc | |
parent | * src/ejabberd_receiver.erl: Workaround for inet_drv bug (diff) |
* src/mod_muc/mod_muc.erl: Bugfix
SVN Revision: 764
Diffstat (limited to 'src/mod_muc')
-rw-r--r-- | src/mod_muc/mod_muc.erl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mod_muc/mod_muc.erl b/src/mod_muc/mod_muc.erl index 8ed1debd..e5014470 100644 --- a/src/mod_muc/mod_muc.erl +++ b/src/mod_muc/mod_muc.erl @@ -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), |