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)),
|
lists:keysort(1, DefRoomOpts)),
|
||||||
case mod_muc:create_room(Host, Name, RoomOpts) of
|
case mod_muc:create_room(Host, Name, RoomOpts) of
|
||||||
ok ->
|
ok ->
|
||||||
ok;
|
maybe_store_room(ServerHost, Host, Name, RoomOpts);
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
throw({error, "Unable to start room"})
|
throw({error, "Unable to start room"})
|
||||||
end;
|
end;
|
||||||
|
@ -705,6 +705,15 @@ create_room_with_opts(Name1, Host1, ServerHost1, CustomRoomOpts) ->
|
||||||
end
|
end
|
||||||
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.
|
%% Create the room only in the database.
|
||||||
%% It is required to restart the MUC service for the room to appear.
|
%% It is required to restart the MUC service for the room to appear.
|
||||||
muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) ->
|
muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) ->
|
||||||
|
|
Loading…
Reference in New Issue