diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index c58822526..799f0079f 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -93,8 +93,13 @@ start(_Host, _Opts) -> ejabberd_commands:register_commands(get_commands_spec()). -stop(_Host) -> - ejabberd_commands:unregister_commands(get_commands_spec()). +stop(Host) -> + case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of + false -> + ejabberd_commands:unregister_commands(get_commands_spec()); + true -> + ok + end. reload(_Host, _NewOpts, _OldOpts) -> ok. diff --git a/src/mod_mam.erl b/src/mod_mam.erl index a009a9164..2593aaefd 100644 --- a/src/mod_mam.erl +++ b/src/mod_mam.erl @@ -169,8 +169,12 @@ stop(Host) -> false -> ok end, - ejabberd_commands:unregister_commands(get_commands_spec()), - ok. + case gen_mod:is_loaded_elsewhere(Host, ?MODULE) of + false -> + ejabberd_commands:unregister_commands(get_commands_spec()); + true -> + ok + end. reload(Host, NewOpts, OldOpts) -> NewMod = gen_mod:db_mod(Host, NewOpts, ?MODULE), diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index a8dbc2479..ac11283ad 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -62,7 +62,12 @@ start(Host, _Opts) -> ejabberd_hooks:add(webadmin_page_host, Host, ?MODULE, web_page_host, 50). 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_host, Host, ?MODULE, web_menu_host, 50), ejabberd_hooks:delete(webadmin_page_main, ?MODULE, web_page_main, 50), diff --git a/src/mod_push.erl b/src/mod_push.erl index 5bc9ce9f0..c947ecace 100644 --- a/src/mod_push.erl +++ b/src/mod_push.erl @@ -101,7 +101,12 @@ start(Host, Opts) -> stop(Host) -> unregister_hooks(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. reload(Host, NewOpts, OldOpts) ->