jabbered 17.01离线消息钩子给出错误

时间:2017-02-09 10:47:55

标签: ejabberd ejabberd-module ejabberd-hooks

我正在尝试为ejabberd 17.01编写模块。它一直致力于ejabberd 16.08。

我使用软件包安装程序安装了ejabberd。

-module(mod_imran_offline).
-author('igggg').

-behaviour(gen_mod).

%% Required by ?INFO_MSG macros
-include("logger.hrl").

-export([start/2, stop/1,on_offline/4]).

start(_Host, _Opts) ->
    ?INFO_MSG("Hello, ejabberd world!", []),
    ejabberd_hooks:add(offline_message_hook, _Host, ?MODULE, on_offline, 10),
    ok.

stop(_Host) ->
    ?INFO_MSG("Bye bye, ejabberd world!", []),
    ejabberd_hooks:delete(offline_message_hook, _Host, ?MODULE, on_offline, 10),
    ok.

on_offline(_User, _Server, _Resource, _Packet) ->
    ?INFO_MSG("Posting From ~p Body ~p~n",[_User, _Packet]),
    none.

我在日志中遇到以下错误

====================================

2017-02-09 05:36:45.825 [错误]< 0.660.0> @ejabberd_hooks:run1:332 {undef,[{mod_offline_test,on_offline,[{jid,<<" FROM -jid">>,<<" MY-SERVER-NAME">>,<<" RESOURCE">>,< <" FROM-JID">>,<<" MY-SERVER-NAME">>,<<" RESOURCE" >>},{JID,<<" TO-JID">>,<<" MY-SERVER-NAME">>,&LT ;<>>,<<" TO-JID">>,<<" MY-SERVER-NAME">>,< <>>},{消息,<<" B094705E-3F0B-4AA2-9630-C5A6DEEE7033">>,聊天,<<>>,{JID, <<" FROM-JID">>,<<" MY-SERVER-NAME">>,<<" RESOURCE&# 34;>>,<<" FROM-JID">>,<<" MY-SERVER-NAME">>,<&LT ;" RESOURCE">>},{JID,<<" TO-JID">>,<<" MY-SERVER-NAME& #34;>>,<<>>,<<" TO-JID">>,<<" MY-SERV ER-NAME">>,<<>>},[],[{文本,<<>>,<<" RRRRRRR"&GT ;>}],未定义,[],#{}}],[]},{ejabberd_hooks,safe_apply,3,[{文件," SRC / ejabberd_hooks.erl"},{线,382 }]},{ejabberd_hooks,run1,3,[{文件," SRC / ejabberd_hooks.erl"},{线,329}]},{ejabberd_sm,路线,3,[{文件,&# 34; SRC / ejabberd_sm.erl"},{线,126}]},{ejabberd_local,路线,3,[{文件," SRC / ejabberd_local.erl"},{线,110} ]},{ejabberd_router,路线,3,[{文件," SRC / ejabberd_router.erl"},{线,87}]},{ejabberd_c2s,check_privacy_route,5,[{文件,&#34 ; SRC / ejabberd_c2s.erl"},{线,1886}]},{ejabberd_c2s,session_established2,2,[{文件," SRC / ejabberd_c2s.erl"},{线,1170}] }]} 正在运行的钩子:{offline_message_hook,[{jid,<<" FROM-JID">>,<<" MY-SERVER-NAME">>, <<" RESOURCE">>,<<" FROM-JID">>,<<" MY-SERVER-NAME&# 34;>>,<<" RESOURCE">>},{JID,<<" TO-JID">>,<&LT ;" MY-SERVER-NAME">>,<<>>,<<" TO-JID">>,<< " MY-SERVER-NAME">>,<<>>},{消息,<<" B094705E-3F0B-4AA2-9630-C5A6DEEE7033" >>,聊天,<<>>,{JID,<<" FROM-JID">>,<<" MY - 服务器NAME">>,<<" RESOURCE">>,<<" FROM-JID">>,<<& #34; MY-SERVER-NAME">>,<<" RESOURCE">>},{JID,<<" TO-JID&#34 ;>>,<<" MY-SERVER-NAME">>,<<>>,<<" TO-JID" >>,<<" MY-SERVER-NAME">>,<<>>},[],[{文本,<<>&GT ;,<<&# 34; RRRRRRR">>}],未定义,[],#{}}]}

====================================

1 个答案:

答案 0 :(得分:0)

你应该返回数据包而不是没有