diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index a595d00c3..47b28f7a8 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -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) ->