[ejabberd] why is mod_offline.handle_info implemented?

Gaurav Jain monkeyfdude at gmail.com
Sat Feb 28 19:06:55 MSK 2015


Hi,

My understand is that when we add event hook, then we specify the function
that will be called when the event happens

https://www.process-one.net/en/wiki/ejabberd_events_and_hooks/

   - The *Module* and *Function* parameters describe the hook to be called
   when the event occurs.

But I notice that in mod_offline.erl, handle_info is implemented as well.

* Would you be able to tell why is hadle_info implemented in
mod_offline.erl?
* How will this be called?
* And under which situtations?


--------------------------------------------------------------------------------------
handle_info(#offline_msg{us = UserServer} = Msg, State) ->
    #state{host = Host,
           access_max_offline_messages = AccessMaxOfflineMsgs} = State,
    DBType = gen_mod:db_type(Host, ?MODULE),
    Msgs = receive_all(UserServer, [Msg], DBType),
    Len = length(Msgs),
    MaxOfflineMsgs = get_max_user_messages(AccessMaxOfflineMsgs,
                                           UserServer, Host),
    store_offline_msg(Host, UserServer, Msgs, Len, MaxOfflineMsgs, DBType),
    {noreply, State};
--------------------------------------------------------------------------------------

Best Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20150228/6383e81c/attachment.html>


More information about the ejabberd mailing list