25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-03 14:45:16 +02:00

Store room to disc on creation if room is persistent

If the mod_muc configuration says that rooms are
persistent by default, store the room to disc once
it is created, as there are use cases where there are
no further config after room creation, and so
the write to disc was never triggered.
This commit is contained in:
Pablo Polvorin 2011-10-18 13:45:02 -03:00
parent 7b0174a626
commit 3850b91571

View File

@ -141,6 +141,16 @@ init([Host, ServerHost, Access, Room, HistorySize, PersistHistory, RoomShaper, C
just_created = true,
room_shaper = Shaper}),
State1 = set_opts(DefRoomOpts, State),
%% this will trigger a write of the muc to disc if it is persistent.
%% we need to do this because otherwise if muc are persistent by default,
%% but never configured in any way by the client, we were never
%% storing it on disc to be recreated on startup.
if
(State1#state.config)#config.persistent ->
mod_muc:store_room(State1#state.host, State1#state.room, make_opts(State1));
true ->
ok
end,
?INFO_MSG("Created MUC room ~s@~s by ~s",
[Room, Host, jlib:jid_to_string(Creator)]),
add_to_log(room_existence, created, State1),