title: ejabberd gen_mod development issue
body: <p>Following this <a href="https://stackoverflow.com/questions/1954402/ejabberd-supervisor-module">stackoverflow question</a>, and <a href="http://anders.conbere.org/blog/2008/08/06/building_ejabberd_modules_-_part_4_-_xmpp_bots/" rel="nofollow noreferrer">this tutorial series</a>, I implemented mod_test module, which implements both gen_mod and gen_server behaviours. It is very stupid for now, since it does nothing more that adding itself to ejabber_sup. </p>
  
  <p>My problem is that I am not sure whether the module is started by ejabberd_sup or not since I can't find it in the list provided by:</p>
  
  <pre><code>supervisor:which_children(ejabberd_sup).
  </code></pre>
  
  <p>Given that I have gen_mod.beam and mod_test.erl in the same directory, I compiled my code using:</p>
  
  <pre><code>erlc -pa ./ mod_test.erl
  </code></pre>
  
  <p>and this gives no errors. After compilation, I copied the file into ebin folder of ejabberd installation and changed ejabberd.cfg adding:</p>
  
  <pre><code>....
  {mod_test, []},
  ....
  </code></pre>
  
  <p>My code is  the following:</p>
  
  <pre><code>-module(mod_test).
  
  -behaviour(gen_server).
  -behaviour(gen_mod).
  
  -export([start/2, stop/1]).
  
  -export([start_link/2]).
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
           terminate/2, code_change/3]).
  
  
  -record(state, {}).
  
  start(Host, Opts) -&gt;
      Proc = gen_mod:get_module_proc(Host, ?MODULE),
      ChildSpec = {Proc,
                   {?MODULE, start_link, [Host, Opts]},
                   permanent,
                   1000,
                   worker,
                   [?MODULE]},
      supervisor:start_child(ejabberd_sup, ChildSpec).
  
  stop(Host) -&gt;
      Proc = gen_mod:get_module_proc(Host, ?MODULE),
      supervisor:terminate_child(ejabberd_sup, Proc),
      supervisor:delete_child(ejabberd_sup, Proc).
  
  start_link(_Host, _Opts) -&gt;
      gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
  
  init([]) -&gt;
      {ok, #state{}}.
  
  handle_call(_Request, _From, State) -&gt;
      Reply = ok,
      {reply, Reply, State}.
  
  handle_cast(_Msg, State) -&gt;
      {noreply, State}.
  
  handle_info(_Info, State) -&gt;
      {noreply, State}.
  
  terminate(_Reason, _State) -&gt;
      ok.
  
  code_change(_OldVsn, State, _Extra) -&gt;
      {ok, State}.
  </code></pre>
  
  <p>Is something wrong in my approach? How can I be sure that the module is correctly started?</p>