[ejabberd] why is mod_offline.handle_info implemented?

Holger Weiß holger at zedat.fu-berlin.de
Sun Mar 1 20:16:42 MSK 2015

* Gaurav Jain <monkeyfdude at gmail.com> [2015-03-01 08:29]:
> My confusion is/was:
> * Under which circumstances the* gen_server:callback:handle_info* will be
>   triggered (*Use case*)

It is used internally by mod_offline to pass an offline message to the
process which stores that message:


Instead of passing the message using the "!" operator and receiving it
with handle_info/2, mod_offline could use gen_server:cast/2 to send and
handle_cast/2 to receive it.  The effect would be mostly the same.

> I wrote a custom module based on (*offlline_message_hook*)
> https://www.process-one.net/en/wiki/ejabberd_events_and_hooks/
> which does *NOT* require us to implement *gen_server*:*handle_info*

Indeed, the ejabberd API doesn't require you to implement a gen_server
at all.  Whether or not it would be a good idea depends on your module.


More information about the ejabberd mailing list