user_send_packet event hook not receiving presence packets

in my module i am adding a event hook for user_send_packet. I trying to log all the packets sent by a user. I also want to log any presence packet sent by the user. but for some reason, i am not receiving the presence packets on the event hook. I do get IQ and chat message packets. Is this a normal behaviour or is there some configuration i need to do to make this work. any help appreciated. thanks guys.


Looking at the ejabberd

Looking at the ejabberd source code, it seems presence packets sent by the user use a different set of hooks:

  • When a local user sends the initial presence at login, or changes his presence information ('show' element, priority, or status text): set_presence_hook(User, Server, Resource, PresenceEl)
  • When a local user sends a presence of type 'unavailable': unset_presence_hook(User, Server, Resource, StatusText)
  • When a local user closes his c2s connection: unset_presence_hook(User, Server, Resource, PresenceEl)
  • When a local user closes his c2s connection after sending an unavailable presence, none of those hooks is called.

thanks for the help. but the

thanks for the help. but the problem is none of the hooks are fired for muc events. more specifically i want to get hold of any presence message sent by a user to muc room. the module i am writing POSTs these packets to our weblogic server. One of the requirements is the server should not receive duplicate packets. so i have to filter all the messages in the ejabberd module before POSTing. which is very difficult if listening on user_receive_packet, which is only hook i know of which will give me presence packets of muc.

ofcourse, it would be great if user_send_packet worked.


Syndicate content