Hi I am working on ejabberd and I am quite new to this technology.
I am trying to add a user on my ejabberd server using this code:
try {
Goto C:\Program Files (x86)\ejabberd-2.1.8\conf (in my case) folder & open ejabberd.cfg file using Notepad++ (it is easy to edit using it).
In the file do the following changes:
%% Put this in the section ACCESS RULES
{access, register_from, [{allow, admin}]}.
%% Change mod_register so it contains the new access rule:
{mod_register, [
{access_from, register_from},
...
] ...
In my case, i need to edit the file EJABERD_HOME/conf/ejabberd.yml, on mod_register change parameters to:
ip_access : all
access_from : all
access: register
To allow users register from another host
I want to update the answer to reflect the change in Asmack library version 4.0 onward. Connection.getAccountManager() is now AccountManager.getInstance(XMPPConnection)
AccountManager accountManager=AccountManager.getInstance(connection);
try {
accountManager.createAccount("username", "password");
} catch (XMPPException e1) {
Log.d(e1.getMessage(), e1);
}
For yaml configuration as follows.
access_rules:
local:
allow: all
configure:
allow: all
trusted_network:
allow: all
register:
allow: all
.......
modules:
mod_register:
ip_access: trusted_network
access: register
access_from: all
Note: This is allow all configuration. Make strict configuration as required.