Terminate hook processing in module

Hi, I'm writing an ejabberd module. What it does is saving some messages into a queue. It actually works very good, there is only one thing I can't find in any documentation. I need to stop hook processing if I find a message coming from a particular user.

I.e. a message is sent to ejabberd, from user A to user B, my module (hooked to user_send_packet hook) processes this message and, if it finds that user A is the specified user, must not deliver it. From what I understood you can achieve this by stopping hook processing. How do you stop hook processing?

To stop ejabberd from calling

To stop ejabberd from calling other functions in that hook, your function must return: stop

Returning stop at the end of

Returning stop at the end of the function that's hooked to user_send_packet the message sent gets delivered anyway. I solved it hooking another function to filter_packet, and returning drop. This way it drops the packet. Anyway I don't know if it's the correct way to go. ejabberd documentation is really poor :(

Thanks for your answer!

Syndicate content