[ejabberd] another mod_service_log question

Daniel Dormont dan at greywallsoftware.com
Wed Mar 23 22:16:23 MSK 2011


Thanks, this led me to dig into the code for ejabberd_c2s where I found that only packets *actually* sent by the user are run through the user_send_packet hook. The "unavailable" packet generated internally by terminate/3 is not sent to that hook. Fortunately, as Badlop implied, I found that there are other hooks I can tap into: unset_presence and sm_remove_connection, depending on my exact need.

Just wondering - is there a developer doc that explains this information, namely a list of the available hooks and their role in the ejabberd data flow?

dan

On Mar 22, 2011, at 7:40 PM, Badlop wrote:

> 2011/3/22 Daniel Dormont <dan at greywallsoftware.com>:
>> But the very first packet
>> in my snippet above - the one *from* the user *to* the room - shouldn't that
>> be logged?
> 
> Looking at mod_service_log source code, it adds hooks to the events
> user_send_packet and user_receive_packet.
> 
> I imagine that your case is: ejabberd closes a client connection and
> later kicks that room occupant out of the room without other
> occupants. In that case no packet is sent or received by any user, and
> consequently the mentioned events aren't run.
> 
> You can:
> 1. Add some INFO_MSG lines to ejabberd_hooks.erl, then provoke your
> case and see in the logs what events are really ran by ejabberd in
> that specific case.
> 
> 2. If no useful event is run, you'll have to customize also
> mod_muc_room in order to run an event as you desire.
> 
> 3. Once you know which event is run in your case, customize
> mod_service_log to add a hook for that event.
> 
> 
> ---
> Badlop
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd



More information about the ejabberd mailing list