diff --git a/include/mod_muc_room.hrl b/include/mod_muc_room.hrl index a278e3ae3..1d0ca4442 100644 --- a/include/mod_muc_room.hrl +++ b/include/mod_muc_room.hrl @@ -44,7 +44,7 @@ allow_visitor_nickchange = true :: boolean(), public = true :: boolean(), public_list = true :: boolean(), - persistent = false :: boolean(), + persistent = false :: boolean() | {destroying, boolean()}, moderated = true :: boolean(), captcha_protected = false :: boolean(), members_by_default = true :: boolean(), diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl index c37d4c187..3f2b65b3e 100644 --- a/src/ejabberd_auth.erl +++ b/src/ejabberd_auth.erl @@ -293,6 +293,8 @@ try_register(User, Server, Password) -> false -> case ejabberd_router:is_my_host(LServer) of true -> + case ejabberd_hooks:run_fold(check_register_user, LServer, true, [User, Server, Password]) of + true -> case lists:foldl( fun(_, ok) -> ok; @@ -307,6 +309,9 @@ try_register(User, Server, Password) -> {error, _} = Err -> Err end; + false -> + {error, not_allowed} + end; false -> {error, not_allowed} end diff --git a/src/ejabberd_web_admin.erl b/src/ejabberd_web_admin.erl index 9dce1ff70..35441b700 100644 --- a/src/ejabberd_web_admin.erl +++ b/src/ejabberd_web_admin.erl @@ -1726,7 +1726,7 @@ make_command_raw_value(Name, Request, BaseArguments) -> raw_value | raw_and_value} | {input_name_append, [binary()]} | - {force_execution, boolean()} | + {force_execution, boolean() | undefined} | {table_options, {PageSize :: integer(), RemainingPath :: [binary()]}} | {result_named, boolean()} | {result_links, @@ -1737,7 +1737,7 @@ make_command_raw_value(Name, Request, BaseArguments) -> {style, normal | danger}. make_command2(Name, Request, BaseArguments, Options) -> Only = proplists:get_value(only, Options, all), - ForceExecution = proplists:get_value(force_execution, Options, false), + ForceExecution = proplists:get_value(force_execution, Options, undefined), InputNameAppend = proplists:get_value(input_name_append, Options, []), Resultnamed = proplists:get_value(result_named, Options, false), ResultLinks = proplists:get_value(result_links, Options, []), @@ -1791,6 +1791,8 @@ make_command2(Name, case {ForceExecution, ResultFormatApi} of {true, _} -> auto; + {false, _} -> + manual; {_, {_, rescode}} -> manual; {_, {_, restuple}} -> diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 73b7a7386..da2f70b78 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -540,7 +540,7 @@ normal_state({route, <<"">>, case NewStateData of stop -> Conf = StateData#state.config, - {stop, normal, StateData#state{config = Conf#config{persistent = false}}}; + {stop, normal, StateData#state{config = Conf#config{persistent = {destroying, Conf#config.persistent}}}}; _ when NewStateData#state.just_created -> close_room_if_temporary_and_empty(NewStateData); _ -> @@ -736,7 +736,7 @@ handle_event({destroy, Reason}, _StateName, [jid:encode(StateData#state.jid), Reason]), add_to_log(room_existence, destroyed, StateData), Conf = StateData#state.config, - {stop, shutdown, StateData#state{config = Conf#config{persistent = false}}}; + {stop, shutdown, StateData#state{config = Conf#config{persistent = {destroying, Conf#config.persistent}}}}; handle_event(destroy, StateName, StateData) -> ?INFO_MSG("Destroyed MUC room ~ts", [jid:encode(StateData#state.jid)]), @@ -856,7 +856,7 @@ handle_sync_event({muc_unsubscribe, From}, _From, StateName, from = From, sub_els = [#muc_unsubscribe{}]}, case process_iq_mucsub(From, IQ, StateData) of {result, _, stop} -> - {stop, normal, StateData#state{config = Conf#config{persistent = false}}}; + {stop, normal, StateData#state{config = Conf#config{persistent = {destroying, Conf#config.persistent}}}}; {result, _, NewState} -> {reply, ok, StateName, NewState}; {ignore, NewState} -> @@ -1015,8 +1015,10 @@ terminate(Reason, _StateName, _ -> add_to_log(room_existence, stopped, StateData), case (StateData#state.config)#config.persistent of - false -> - ejabberd_hooks:run(room_destroyed, LServer, [LServer, Room, Host]); + false -> + ejabberd_hooks:run(room_destroyed, LServer, [LServer, Room, Host, false]); + {destroying, Persistent} -> + ejabberd_hooks:run(room_destroyed, LServer, [LServer, Room, Host, Persistent]); _ -> ok end