./ct_report/coverage/service_admin_extra.COVER.html

1 %%%-------------------------------------------------------------------
2 %%% File : service_admin_extra.erl
3 %%% Author : Badlop <badlop@process-one.net>, Piotr Nosek <piotr.nosek@erlang-solutions.com>
4 %%% Purpose : Contributed administrative functions and commands
5 %%% Created : 10 Aug 2008 by Badlop <badlop@process-one.net>
6 %%%
7 %%%
8 %%% ejabberd, Copyright (C) 2002-2008 ProcessOne
9 %%%
10 %%% This program is free software; you can redistribute it and/or
11 %%% modify it under the terms of the GNU General Public License as
12 %%% published by the Free Software Foundation; either version 2 of the
13 %%% License, or (at your option) any later version.
14 %%%
15 %%% This program is distributed in the hope that it will be useful,
16 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
17 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 %%% General Public License for more details.
19 %%%
20 %%% You should have received a copy of the GNU General Public License
21 %%% along with this program; if not, write to the Free Software
22 %%% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 %%%
24 %%%-------------------------------------------------------------------
25
26 -module(service_admin_extra).
27 -author('badlop@process-one.net').
28
29 -behaviour(mongoose_service).
30
31 -include("mongoose_config_spec.hrl").
32
33 -export([start/1, stop/0, config_spec/0]).
34
35 -define(SUBMODS, [node, accounts, sessions, vcard, roster, last,
36 private, stanza, stats, gdpr, upload, domain
37 %, srg %% Disabled until we add mod_shared_roster
38 ]).
39
40 %%%
41 %%% gen_mod
42 %%%
43
44 start(Opts) ->
45 82 Submods = gen_mod:get_opt(submods, Opts, ?SUBMODS),
46 82 lists:foreach(fun(Submod) ->
47 984 ejabberd_commands:register_commands((mod_name(Submod)):commands())
48 end, Submods).
49
50 stop() ->
51 82 lists:foreach(fun(Submod) ->
52 984 ejabberd_commands:unregister_commands((mod_name(Submod)):commands())
53 end, ?SUBMODS).
54
55 -spec config_spec() -> mongoose_config_spec:config_section().
56 config_spec() ->
57 82 #section{
58 items = #{<<"submods">> => #list{items = #option{type = atom,
59 validate = {enum, ?SUBMODS}},
60 validate = unique}
61 }
62 }.
63
64 mod_name(ModAtom) ->
65 1968 list_to_existing_atom(atom_to_list(?MODULE) ++ "_" ++ atom_to_list(ModAtom)).
66
Line Hits Source