diff options
author | Evgeniy Khramtsov <xramtsov@gmail.com> | 2009-08-26 04:14:54 +0000 |
---|---|---|
committer | Evgeniy Khramtsov <xramtsov@gmail.com> | 2009-08-26 04:14:54 +0000 |
commit | 2c735c91d64a45b70b8a41d7a3d667699ac37668 (patch) | |
tree | c0ccbdf6ecfa17e461f0d20baaa0f5e19797d98f /src | |
parent | resolve EJAB-1025, send notification when owner changed entity subscription (diff) |
check if a room is not persistent before starting a new one with the same name (EJAB-1026)
SVN Revision: 2539
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_muc/mod_muc.erl | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mod_muc/mod_muc.erl b/src/mod_muc/mod_muc.erl index 22e8bb6e0..c0e2168ae 100644 --- a/src/mod_muc/mod_muc.erl +++ b/src/mod_muc/mod_muc.erl @@ -468,8 +468,7 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper, AccessCreate, From, Room) of true -> - ?DEBUG("MUC: open new room '~s'~n", [Room]), - {ok, Pid} = mod_muc_room:start( + {ok, Pid} = start_new_room( Host, ServerHost, Access, Room, HistorySize, RoomShaper, From, @@ -538,6 +537,23 @@ load_permanent_rooms(Host, ServerHost, Access, HistorySize, RoomShaper) -> end, Rs) end. +start_new_room(Host, ServerHost, Access, Room, + HistorySize, RoomShaper, From, + Nick, DefRoomOpts) -> + case mnesia:dirty_read(muc_room, {Room, Host}) of + [] -> + ?DEBUG("MUC: open new room '~s'~n", [Room]), + mod_muc_room:start(Host, ServerHost, Access, + Room, HistorySize, + RoomShaper, From, + Nick, DefRoomOpts); + [#muc_room{opts = Opts}|_] -> + ?DEBUG("MUC: restore room '~s'~n", [Room]), + mod_muc_room:start(Host, ServerHost, Access, + Room, HistorySize, + RoomShaper, Opts) + end. + register_room(Host, Room, Pid) -> F = fun() -> mnesia:write(#muc_online_room{name_host = {Room, Host}, |