Create new user, add to contacts from Erlang

Using Erlang, I want to:
1. Create a new user with the username of "user1@mydomain.com"
2. Add "user1@mydomain.com" as a contact of "user1@mydomain.com"

How can I do this for ejabberd using Erlang?

Check the source code of

Check the source code of these ejabberd commands. They are implemented in mod_admin_extra.erl:

$ ejabberdctl register testuser1 localhost pass123
User testuser1@localhost succesfully registered
$ ejabberdctl add_rosteritem badlop localhost testuser1 localhost TestUser1 Friends none
Syndicate content