正确的语法在ejabberd-18.12钩user_receive_packet?

时间:2019-02-01 17:23:03

标签: ejabberd ejabberd-module ejabberd-hooks

当前代码:

user_receive_packet({Packet, C2SState}) ->

    ?INFO_MSG("~p.", [Packet]),
    {Packet, C2SState}.

在调用钩子时出错:

[error] Hook user_receive_packet crashed when running... 
** Reason = {error,function_clause...

我猜函数参数是错误的。正确的语法应该是什么?我正在使用ejabberd-18.12

1 个答案:

答案 0 :(得分:0)

正确的语法:

user_receive_packet({Packet, #{jid := JID} = C2SState}) ->

    {Packet, C2SState}.