]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_muc/mod_muc.erl: Bugfix
authorAlexey Shchepin <alexey@process-one.net>
Wed, 9 May 2007 14:47:58 +0000 (14:47 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Wed, 9 May 2007 14:47:58 +0000 (14:47 +0000)
SVN Revision: 764

ChangeLog
src/mod_muc/mod_muc.erl

index 5e5557b4d05c6d093736a8d8543e822bc9001a72..dff1af06173045b6bbb44ffcc690ecd01129ca80 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 8ed1debdd2b713d24a34a0f2dc6e598ef18bf0d9..e5014470457c968485594c850929276a9191dced 100644 (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),