diff options
author | Badlop <badlop@process-one.net> | 2021-07-07 17:32:55 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2021-07-08 12:29:13 +0200 |
commit | 271a9f097d251fb76912f935f83b29bae833799b (patch) | |
tree | 77ab87ab1039a03056e33ea0f00a8f4647b5ffa4 | |
parent | Ignore captcha scripts copied by relx after "make dev" (diff) |
After create_room, store in DB if it's persistent (#3632)
-rw-r--r-- | src/mod_muc_admin.erl | 11 |
1 files changed, 10 insertions, 1 deletions
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) -> |