24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-09-21 14:06:57 +02:00

check if a room is not persistent before starting a new one with the same name (EJAB-1026)

SVN Revision: 2540
This commit is contained in:
Evgeniy Khramtsov 2009-08-26 04:18:42 +00:00
parent f7c5a4a15b
commit ba3a45452e

View File

@ -454,8 +454,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,
@ -527,6 +526,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) when is_binary(Host), is_binary(Room) ->
F = fun() ->
mnesia:write(#muc_online_room{name_host = {Room, Host},