correct syntax for the hook user_receive_packet in ejabberd-18.12?

69 views Asked by At

Current code :

user_receive_packet({Packet, C2SState}) ->

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

Getting error when the hook is invoked:

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

I guess the function arguments are wrong. What should be the correct syntax ? I am using ejabberd-18.12

1

There are 1 answers

0
Md. Arafat Al Mahmud On BEST ANSWER

Correct Syntax:

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

    {Packet, C2SState}.