[ejabberd] why is mod_offline.handle_info implemented?

Gaurav Jain monkeyfdude at gmail.com
Sun Mar 1 20:47:54 MSK 2015


Thanks for clarification.

You note in the end "*Whether or not it would be a good idea depends on
your module*" has got me worried/scared but I think I will crash and learn.

Thanks again.



On Sun, Mar 1, 2015 at 9:16 AM, Holger Weiß <holger at zedat.fu-berlin.de>
wrote:

> * 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:
>
>
> https://github.com/processone/ejabberd/blob/a265ea53f97/src/mod_offline.erl#L313
>
> 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.
>
> Holger
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20150301/75e5d404/attachment.html>


More information about the ejabberd mailing list