I can not use `ejabberd_auth` in my project ** helloworld **

I cannot use helloworldejabberd_auth in my project .

-behaviour(ejabberd_auth). 
... 
....  
try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).  

With this, I get an error warning:

helloworld.erl:15: Warning: behaviour ejabberd_auth undefined    


-import(ejabberd_auth, [try_register/3]).  
... 
....  
try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).  

With this, I get:

exception error: undefined function ejabberd_auth:try_register/3  

Why am I unable to access ? ejabberd_auth

I am using IntelliJ Idea with the Erlang plugin installed.

Thanks to everyone in advance.

UPDATE:
I'm on Ubuntu 16.04 LTS

+4
source share
1 answer

I can get past this error. Here's how ...

When I compile a module in the erlang shell, the compiler creates a file .beamin the same directory that allows me to call the functions defined in the module. In your case, if you are in a directory:

 .../ejabberd/ebin 

ejabberd.beam, ejabberd_auth.beam. erlang , ( ), .

, :

exception error: undefined function jid:nodeprep/1
     in function  ejabberd_auth:validate_credentials/3 (src/ejabberd_auth.erl, line 796)
     in call from ejabberd_auth:try_register/3 (src/ejabberd_auth.erl, line`

jid.beam. :

~/Downloads/ejabberd$ find . -name jid.beam
./deps/xmpp/ebin/jid.beam

, , ejabberd . . ejabberd, .

ejabberd_auth helloworld.

-?

+4

Source: https://habr.com/ru/post/1694736/


All Articles