7

Hooks seem to be pretty handy to extend the funcionality of ejabberd.

There are bunch of ejabberd hooks mentioned by the makers,but it difficult to understand which one is to be used when,apart from few.

can anybody share some details from their experiences that explains what a particular hook does?

HIRA THAKUR
  • 17,189
  • 14
  • 56
  • 87

2 Answers2

1

There will be certain events on which you would like to trigger some action.Hooks couples your code with some components of ejabberd when an event occurs.You can write your own custom code(a.ka. Event Handler) and integrate it to ejabberd with HOOK.

  • filter_packet : This hook is run by ejabberd_router as soon as the packet is routed via ejaberd_router:route/3. ejabberd_c2s calls it after it receives a packet from ejabberd_receiver(i.e. the socket) and multiple modules use it for sending replies and errors.
  • offline_message_hook : when ejabberd routes the stanza and receiver is offline.
  • user_receive_packet : The hook is run just after a packet has been sent to the user.
HIRA THAKUR
  • 17,189
  • 14
  • 56
  • 87
0

sm_remove_connection_hook and

sm_register_connection_hook

are also very handy to capture when the user goes off- and on-line.

Jeyhey
  • 490
  • 3
  • 16