From egoscia's answer on the question Register a new user in ejabberd using Erlang , he says in the accepted answer that you can add a new user using:
ejabberd_auth:try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).
I tried using this in erlang, but I get the error:
** exception error: undefined function ejabberd_auth:try_register/3
This is a snippet of how I go about it:
-import(ejabberd_auth, [try_register/3]).
start() ->
io:fwrite("Hello World!\nThis is Sound\n"),
% Chat
ejabberd_auth:try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).
How should I go about it erlang? Java/ Android/ C++/ Qt suggestions also welcome.
Thank you all in advance.
** exception error: undefined function ejabberd_auth:try_register/3
Oh, that code works for me using ejabberd 18.03. I start ejabberd in live mode, so I have access to the erlang shell, and I can run correctly:
$ ejabberdctl live
...
(ejabberd@localhost)2> ejabberd_auth:try_register(<<"user6">>, <<"localhost">>, <<"somepass">>).
ok
Maybe you are using an old ejabberd version that doesn't still export ejabberd_auth:try_register/3 ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.