mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
After create_room, store in DB if it's persistent (#3632)
This commit is contained in:
parent
7e3276f3a8
commit
271a9f097d
@ -696,7 +696,7 @@ create_room_with_opts(Name1, Host1, ServerHost1, CustomRoomOpts) ->
|
||||
lists:keysort(1, DefRoomOpts)),
|
||||
case mod_muc:create_room(Host, Name, RoomOpts) of
|
||||
ok ->
|
||||
ok;
|
||||
maybe_store_room(ServerHost, Host, Name, RoomOpts);
|
||||
{error, _} ->
|
||||
throw({error, "Unable to start room"})
|
||||
end;
|
||||
@ -705,6 +705,15 @@ create_room_with_opts(Name1, Host1, ServerHost1, CustomRoomOpts) ->
|
||||
end
|
||||
end.
|
||||
|
||||
maybe_store_room(ServerHost, Host, Name, RoomOpts) ->
|
||||
case proplists:get_bool(persistent, RoomOpts) of
|
||||
true ->
|
||||
{atomic, ok} = mod_muc:store_room(ServerHost, Host, Name, RoomOpts),
|
||||
ok;
|
||||
false ->
|
||||
ok
|
||||
end.
|
||||
|
||||
%% Create the room only in the database.
|
||||
%% It is required to restart the MUC service for the room to appear.
|
||||
muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) ->
|
||||
|
Loading…
Reference in New Issue
Block a user