mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Update mod_disco to the new gen_mod API
This commit is contained in:
parent
5a9099f49c
commit
03ffbe00c1
@ -51,16 +51,6 @@
|
||||
-export_type([features_acc/0, items_acc/0]).
|
||||
|
||||
start(Host, Opts) ->
|
||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host,
|
||||
?NS_DISCO_ITEMS, ?MODULE,
|
||||
process_local_iq_items),
|
||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host,
|
||||
?NS_DISCO_INFO, ?MODULE,
|
||||
process_local_iq_info),
|
||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host,
|
||||
?NS_DISCO_ITEMS, ?MODULE, process_sm_iq_items),
|
||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host,
|
||||
?NS_DISCO_INFO, ?MODULE, process_sm_iq_info),
|
||||
catch ets:new(disco_extra_domains,
|
||||
[named_table, ordered_set, public,
|
||||
{heir, erlang:group_leader(), none}]),
|
||||
@ -69,45 +59,23 @@ start(Host, Opts) ->
|
||||
register_extra_domain(Host, Domain)
|
||||
end,
|
||||
ExtraDomains),
|
||||
ejabberd_hooks:add(disco_local_items, Host, ?MODULE,
|
||||
get_local_services, 100),
|
||||
ejabberd_hooks:add(disco_local_features, Host, ?MODULE,
|
||||
get_local_features, 100),
|
||||
ejabberd_hooks:add(disco_local_identity, Host, ?MODULE,
|
||||
get_local_identity, 100),
|
||||
ejabberd_hooks:add(disco_sm_items, Host, ?MODULE,
|
||||
get_sm_items, 100),
|
||||
ejabberd_hooks:add(disco_sm_features, Host, ?MODULE,
|
||||
get_sm_features, 100),
|
||||
ejabberd_hooks:add(disco_sm_identity, Host, ?MODULE,
|
||||
get_sm_identity, 100),
|
||||
ejabberd_hooks:add(disco_info, Host, ?MODULE, get_info,
|
||||
100),
|
||||
ok.
|
||||
{ok, [{iq_handler, ejabberd_local, ?NS_DISCO_ITEMS,
|
||||
?MODULE, process_local_iq_items},
|
||||
{iq_handler, ejabberd_local, ?NS_DISCO_INFO,
|
||||
?MODULE, process_local_iq_info},
|
||||
{iq_handler, ejabberd_sm, ?NS_DISCO_ITEMS,
|
||||
?MODULE, process_sm_iq_items},
|
||||
{iq_handler, ejabberd_sm, ?NS_DISCO_INFO,
|
||||
?MODULE, process_sm_iq_info},
|
||||
{hook, disco_local_items, ?MODULE, get_local_services, 100},
|
||||
{hook, disco_local_features, ?MODULE, get_local_features, 100},
|
||||
{hook, disco_local_identity, ?MODULE, get_local_identity, 100},
|
||||
{hook, disco_sm_items, ?MODULE, get_sm_items, 100},
|
||||
{hook, disco_sm_features, ?MODULE, get_sm_features, 100},
|
||||
{hook, disco_sm_identity, ?MODULE, get_sm_identity, 100},
|
||||
{hook, disco_info, ?MODULE, get_info, 100}]}.
|
||||
|
||||
stop(Host) ->
|
||||
ejabberd_hooks:delete(disco_sm_identity, Host, ?MODULE,
|
||||
get_sm_identity, 100),
|
||||
ejabberd_hooks:delete(disco_sm_features, Host, ?MODULE,
|
||||
get_sm_features, 100),
|
||||
ejabberd_hooks:delete(disco_sm_items, Host, ?MODULE,
|
||||
get_sm_items, 100),
|
||||
ejabberd_hooks:delete(disco_local_identity, Host,
|
||||
?MODULE, get_local_identity, 100),
|
||||
ejabberd_hooks:delete(disco_local_features, Host,
|
||||
?MODULE, get_local_features, 100),
|
||||
ejabberd_hooks:delete(disco_local_items, Host, ?MODULE,
|
||||
get_local_services, 100),
|
||||
ejabberd_hooks:delete(disco_info, Host, ?MODULE,
|
||||
get_info, 100),
|
||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host,
|
||||
?NS_DISCO_ITEMS),
|
||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host,
|
||||
?NS_DISCO_INFO),
|
||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host,
|
||||
?NS_DISCO_ITEMS),
|
||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host,
|
||||
?NS_DISCO_INFO),
|
||||
catch ets:match_delete(disco_extra_domains,
|
||||
{{'_', Host}}),
|
||||
ok.
|
||||
|
Loading…
Reference in New Issue
Block a user