mod_spam_filter: Fix unregistration of global hook
Don't unregister the 'reopen_log_hook' if the module is loaded for another host.
This commit is contained in:
parent
b410f64f33
commit
f2faca6dc9
|
@ -265,12 +265,17 @@ terminate(Reason, #state{host = Host} = State) ->
|
||||||
DumpFile = gen_mod:get_module_opt(Host, ?MODULE, spam_dump_file),
|
DumpFile = gen_mod:get_module_opt(Host, ?MODULE, spam_dump_file),
|
||||||
DumpFile1 = expand_host(DumpFile, Host),
|
DumpFile1 = expand_host(DumpFile, Host),
|
||||||
close_dump_file(DumpFile1, State),
|
close_dump_file(DumpFile1, State),
|
||||||
ejabberd_hooks:delete(reopen_log_hook, ?MODULE,
|
|
||||||
reopen_log, 50),
|
|
||||||
ejabberd_hooks:delete(s2s_receive_packet, Host, ?MODULE,
|
ejabberd_hooks:delete(s2s_receive_packet, Host, ?MODULE,
|
||||||
s2s_receive_packet, 50),
|
s2s_receive_packet, 50),
|
||||||
ejabberd_hooks:delete(s2s_in_handle_info, Host, ?MODULE,
|
ejabberd_hooks:delete(s2s_in_handle_info, Host, ?MODULE,
|
||||||
s2s_in_handle_info, 90).
|
s2s_in_handle_info, 90),
|
||||||
|
case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of
|
||||||
|
false ->
|
||||||
|
ejabberd_hooks:delete(reopen_log_hook, ?MODULE,
|
||||||
|
reopen_log, 50);
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
-spec code_change({down, term()} | term(), state(), term()) -> {ok, state()}.
|
-spec code_change({down, term()} | term(), state(), term()) -> {ok, state()}.
|
||||||
code_change(_OldVsn, #state{host = Host} = State, _Extra) ->
|
code_change(_OldVsn, #state{host = Host} = State, _Extra) ->
|
||||||
|
|
Loading…
Reference in New Issue