不调用offline_message_hook

时间:2015-12-24 07:53:25

标签: erlang xmpp ejabberd ejabberd-module

我正在处理离线通知。 我试过这段代码http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/

我正在使用mod_http_offline模块。 当用户发送离线消息时,我的错误日志中出现以下错误

running hook: {offline_message_hook,[{jid,<<"1112121212">>,   
              <<"xyz.com.com">>,<<"26112267011450933160669531">>,
              <<"11121212">>,<<"xyz.com">>,
              <<"26112267011450933160669531">>},{jid,<<"12121212">>,
              <<"xyz.com">>,<<"10640377501450932768366216">>,
              <<"918787878787">>,<<"xyz.com">>, 
              <<"10640377501450932768366216">>},{xmlel,<<"message">>,[{<<"from">>,<<"121212121@xyz.com">>},{<<"to">>,<<"11111111@xyz.com/10640377501450932768366216">>},
             {<<"id">>,<<"AqLgKTeu">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"jabber:x:event">>}],[{xmlel,<<"delivevered">>,[],[]},{xmlel,<<"id">>,[],[{xmlcdata,<<"EYx1Bhh0">>}]}]}]}]}


[error] <0.3631.0>@ejabberd_hooks:run1:332 {function_clause,[{lists,thing_to_list,[<<>>],[{file,"lists.erl"},{line,601}]}
        {lists,flatmap,2,[{file,"lists.erl"},{line,1248}]},{lists,flatmap,2,[{file,"lists.erl"},{line,1248}]},{mod_http_offline,post_offline_message,3,[{file,"mod_http_offline.erl"},
        {line,38}]},{ejabberd_hooks,safe_apply,3,[{file,"src/ejabberd_hooks.erl"},{line,382}]},
        {ejabberd_hooks,run1,3,[{file,"src/ejabberd_hooks.erl"},{line,329}]},
        {ejabberd_sm,route,3,[{file,"src/ejabberd_sm.erl"},{line,111}]},
        {ejabberd_local,route,3,[{file,"src/ejabberd_local.erl"},{line,112}]}]}

[error] <0.3703.0>@ejabberd_config:validate_opts:794 unknown option 'loopback' will be likely ignored
[error] <0.3703.0>@ejabberd_config:validate_opts:794 unknown option 'local' will be likely ignored

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您正在运行一个名为lists:thing_to_list/1的模块。此函数不处理二进制。这就是您的代码崩溃的原因(function clause)。

在代码中的某处,您尝试使用空二进制文件(<<>>)连接列表,这是不可能的。

以下是触发错误的示例:

$ erl
Erlang/OTP 18 [erts-7.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V7.2  (abort with ^G)
1> lists:concat(["Hello", <<>>]).
** exception error: no function clause matching 
                    lists:thing_to_list(<<>>) (lists.erl, line 602)
     in function  lists:flatmap/2 (lists.erl, line 1249)
     in call from lists:flatmap/2 (lists.erl, line 1249)