./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 -spec start(mongoose_service:options()) -> ok.
45 start(#{submods := Submods}) ->
46 83 lists:foreach(fun(Submod) ->
47 996 ejabberd_commands:register_commands((mod_name(Submod)):commands())
48 end, Submods).
49
50 -spec stop() -> ok.
51 stop() ->
52 83 lists:foreach(fun(Submod) ->
53 996 ejabberd_commands:unregister_commands((mod_name(Submod)):commands())
54 end, ?SUBMODS).
55
56 -spec config_spec() -> mongoose_config_spec:config_section().
57 config_spec() ->
58 83 #section{
59 items = #{<<"submods">> => #list{items = #option{type = atom,
60 validate = {enum, ?SUBMODS}},
61 validate = unique}
62 },
63 defaults = #{<<"submods">> => ?SUBMODS}
64 }.
65
66 mod_name(ModAtom) ->
67 1992 list_to_existing_atom(atom_to_list(?MODULE) ++ "_" ++ atom_to_list(ModAtom)).
Line Hits Source