anchor.diff:     {"event", Event},
      {Type, Value}].
   
  -% Sends a reportEvent command to the Monitor
  +%@doc Sends a reportEvent command to the Monitor
   report_event(Server, Event) ->
     To = gen_mod:get_module_opt(Server, ?MODULE, monitor_jid, "mon@localhost"),
     XmlBody = {xmlelement, "message", [{"from", ?JID},
  
positive.code: -include("jlib.hrl").
  
  % Required by gen_mod
  -export([start/2, stop/1, on_presence/4]).
  % Required by gen_server
  -export([start_link/2]).
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
  
negative.code: 
    ok.
  
  on_set_presence(User, Server, Resource, _Packet) ->   handle_presence(connect, {User, Server, Resource}).
  on_unset_presence(User, Server, Resource, _Status) -> handle_presence(disconnect, {User, Server, Resource}).
  
  %@doc Handles presence stanzas sent by users
  handle_presence(UserState, {User, Server, Resource} = JID) ->
    {IPAddress, _} = ejabberd:get_user_ip(User, Server, Resource),
    ?DEBUG("User ~p (~p) is ~p", [JID, IPAddress, State]),
  
    % Passes over the processing into a new process
    gen_server:cast(?MODULE, {UserState, JID, IPAddress}),
    report_event(Server, UserState),
    ok.
  
  %%% gen_server %%%
  