mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
check if a room is not persistent before starting a new one with the same name (EJAB-1026)
SVN Revision: 2539
This commit is contained in:
parent
eca4d9c963
commit
2c735c91d6
@ -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},
|
||||
|
Loading…
Reference in New Issue
Block a user