add_to_log2(roomconfig_change_enabledlogging, Occupants, Room, Opts, State) ->
add_message_to_log("", {roomconfig_change, Occupants}, Room, Opts, State);
+add_to_log2(room_existence, NewStatus, Room, Opts, State) ->
+ add_message_to_log("", {room_existence, NewStatus}, Room, Opts, State);
+
add_to_log2(nickchange, {OldNick, NewNick}, Room, Opts, State) ->
add_message_to_log(NewNick, {nickchange, OldNick}, Room, Opts, State);
{nomatch, _} ->
io_lib:format("<font class=\"mn\">~s</font> ~s<br/>",
[Nick2, htmlize(T,NoFollow,FileFormat)])
- end
+ end;
+ {room_existence, RoomNewExistence} ->
+ io_lib:format("<font class=\"mrcm\">~s</font><br/>",
+ [get_room_existence_string(RoomNewExistence, Lang)])
end,
{Hour, Minute, Second} = Time,
STime = lists:flatten(
%%----------------------------------------------------------------------
%% Utilities
+get_room_existence_string(created, Lang) -> ?T("Chatroom is created");
+get_room_existence_string(destroyed, Lang) -> ?T("Chatroom is destroyed");
+get_room_existence_string(started, Lang) -> ?T("Chatroom is started");
+get_room_existence_string(stopped, Lang) -> ?T("Chatroom is stopped").
+
get_dateweek(Date, Lang) ->
Weekday = case calendar:day_of_the_week(Date) of
1 -> ?T("Monday");
State1 = set_opts(DefRoomOpts, State),
?INFO_MSG("Created MUC room ~s@~s by ~s",
[Room, Host, jlib:jid_to_string(Creator)]),
+ add_to_log(room_existence, created, State1),
+ add_to_log(room_existence, started, State1),
{ok, normal_state, State1};
init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Opts]) ->
process_flag(trap_exit, true),
history = lqueue_new(HistorySize),
jid = jlib:make_jid(Room, Host, ""),
room_shaper = Shaper}),
+ add_to_log(room_existence, started, State),
{ok, normal_state, State}.
%%----------------------------------------------------------------------
end}, StateData),
?INFO_MSG("Destroyed MUC room ~s with reason: ~p",
[jlib:jid_to_string(StateData#state.jid), Reason]),
+ add_to_log(room_existence, destroyed, StateData),
{stop, normal, StateData};
handle_event(destroy, StateName, StateData) ->
?INFO_MSG("Destroyed MUC room ~s",
%% Returns: any
%%----------------------------------------------------------------------
terminate(_Reason, _StateName, StateData) ->
+ ?INFO_MSG("Stopping MUC room ~s@~s",
+ [StateData#state.room, StateData#state.host]),
?DICT:fold(
fun(J, _, _) ->
tab_remove_online_user(J, StateData)
end, [], StateData#state.users),
+ add_to_log(room_existence, stopped, StateData),
mod_muc:room_destroyed(StateData#state.host, StateData#state.room, self(),
StateData#state.server_host),
ok.
true ->
?INFO_MSG("Destroyed MUC room ~s because it's temporary and empty",
[jlib:jid_to_string(StateData#state.jid)]),
+ add_to_log(room_existence, destroyed, StateData),
{stop, normal, StateData1};
_ ->
{next_state, normal_state, StateData1}
[{xmlelement, "destroy", _Attrs1, _Els1} = SubEl1] ->
?INFO_MSG("Destroyed MUC room ~s by the owner ~s",
[jlib:jid_to_string(StateData#state.jid), jlib:jid_to_string(From)]),
+ add_to_log(room_existence, destroyed, StateData),
destroy_room(SubEl1, StateData);
Items ->
process_admin_items_set(From, Items, Lang, StateData)