Catch client disconnect

Hello,

I run ejabberd and bot written in erlang/exmpp. I connect to this bot some jabber clients. How can i catch client disconnect?

Thank you.

shk wrote: I run ejabberd and

shk wrote:

I run ejabberd and bot written in erlang/exmpp. I connect to this bot some jabber clients. How can i catch client disconnect?

--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -1428,6 +1428,7 @@ print_state(State = #state{pres_t = T, pres_f = F, pres_a = A, pres_i = I}) ->
 %% Returns: any
 %%----------------------------------------------------------------------
 terminate(_Reason, StateName, StateData) ->
+    ?INFO_MSG("Session closing: ~n~p", [StateData#state.jid]),
     case StateName of
        session_established ->
            case StateData#state.authenticated of
Syndicate content