[ejabberd] gen_server terminated with reason: bad return value:

Gaurav Jain monkeyfdude at gmail.com
Mon Apr 27 19:43:30 MSK 2015


I have code - this was the last function that was executed.

process_packet(From, To, Packet) ->

    #jid{luser = LUser, lserver = LServer} = To,

    gen_mod:get_module_proc(To#jid.lserver, ?PROCNAME) !

            #offline_msg{us = {LUser, LServer},

                       from = From, to = To, packet = Packet},

    ok.

I get this error:

2015-04-27 01:27:26.012 [error] <0.384.0> gen_server 'offline_test'
terminated with reason: bad return value: {offline_msg,{<<"abcdef">>,<<"
example.com">>},{jid,<<"ghijklm">>,<<"example.com">>,<<"phone">>,<<"
ghijklm">>,<<"example.com">>,<<"phone">>},{jid,<<"abcdef">>,<<"example.com
">>,<<>>,<<"abcdef">>,<<"example.com
">>,<<>>},{xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"to">>,<<"
abcdef at example.com">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"Update:
Some">>}]},{xmlel,<<"thread">>,[],[]},{xmlel,<<"subject">>,[],[{xmlcdata,<<"someData">>}]},...]}}


%%====================================================================

%% gen_server callbacks

%%====================================================================


init([Host, Opts]) ->

        ...

        ejabberd_hooks:add(offline_message_hook, Host, ?MODULE,
process_packet, 49),

        {ok, #state{host = Host}}.


handle_call(stop, _From, State) ->

    {stop, normal, ok, State}.


handle_cast(_Msg, State) -> {noreply, State}.


handle_info(#offline_msg{us = _UserServer,

                from = From, to = To, packet = Packet} = _Msg, State) ->

    CustomStatus = read_custom_status(From#jid.user, To#jid.user),

    if CustomStatus == <<"available">> ->

                process_offline_packet(From, To, Packet);

       true -> ok

    end,

    {noreply, State};


handle_info(_Info, State) ->

    {noreply, State}.


terminate(_Reason, State) ->

    Host = State#state.host,

    ejabberd_hooks:delete(offline_message_hook, Host, ?MODULE,
process_packet, 49),

    ok.


Would you be able to tell the issue?



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


More information about the ejabberd mailing list