mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Unregister commands when stopping node only if it's last one (#2083)
This commit is contained in:
parent
7121a95428
commit
cbbfe32d8b
@ -93,8 +93,13 @@
|
|||||||
start(_Host, _Opts) ->
|
start(_Host, _Opts) ->
|
||||||
ejabberd_commands:register_commands(get_commands_spec()).
|
ejabberd_commands:register_commands(get_commands_spec()).
|
||||||
|
|
||||||
stop(_Host) ->
|
stop(Host) ->
|
||||||
ejabberd_commands:unregister_commands(get_commands_spec()).
|
case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of
|
||||||
|
false ->
|
||||||
|
ejabberd_commands:unregister_commands(get_commands_spec());
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
reload(_Host, _NewOpts, _OldOpts) ->
|
reload(_Host, _NewOpts, _OldOpts) ->
|
||||||
ok.
|
ok.
|
||||||
|
@ -169,8 +169,12 @@ stop(Host) ->
|
|||||||
false ->
|
false ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
ejabberd_commands:unregister_commands(get_commands_spec()),
|
case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of
|
||||||
ok.
|
false ->
|
||||||
|
ejabberd_commands:unregister_commands(get_commands_spec());
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
reload(Host, NewOpts, OldOpts) ->
|
reload(Host, NewOpts, OldOpts) ->
|
||||||
NewMod = gen_mod:db_mod(Host, NewOpts, ?MODULE),
|
NewMod = gen_mod:db_mod(Host, NewOpts, ?MODULE),
|
||||||
|
@ -62,7 +62,12 @@ start(Host, _Opts) ->
|
|||||||
ejabberd_hooks:add(webadmin_page_host, Host, ?MODULE, web_page_host, 50).
|
ejabberd_hooks:add(webadmin_page_host, Host, ?MODULE, web_page_host, 50).
|
||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
ejabberd_commands:unregister_commands(get_commands_spec()),
|
case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of
|
||||||
|
false ->
|
||||||
|
ejabberd_commands:unregister_commands(get_commands_spec());
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end,
|
||||||
ejabberd_hooks:delete(webadmin_menu_main, ?MODULE, web_menu_main, 50),
|
ejabberd_hooks:delete(webadmin_menu_main, ?MODULE, web_menu_main, 50),
|
||||||
ejabberd_hooks:delete(webadmin_menu_host, Host, ?MODULE, web_menu_host, 50),
|
ejabberd_hooks:delete(webadmin_menu_host, Host, ?MODULE, web_menu_host, 50),
|
||||||
ejabberd_hooks:delete(webadmin_page_main, ?MODULE, web_page_main, 50),
|
ejabberd_hooks:delete(webadmin_page_main, ?MODULE, web_page_main, 50),
|
||||||
|
@ -101,7 +101,12 @@ start(Host, Opts) ->
|
|||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
unregister_hooks(Host),
|
unregister_hooks(Host),
|
||||||
unregister_iq_handlers(Host),
|
unregister_iq_handlers(Host),
|
||||||
ejabberd_commands:unregister_commands(get_commands_spec()).
|
case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of
|
||||||
|
false ->
|
||||||
|
ejabberd_commands:unregister_commands(get_commands_spec());
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
-spec reload(binary(), gen_mod:opts(), gen_mod:opts()) -> ok.
|
-spec reload(binary(), gen_mod:opts(), gen_mod:opts()) -> ok.
|
||||||
reload(Host, NewOpts, OldOpts) ->
|
reload(Host, NewOpts, OldOpts) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user