Skip to content
This repository

API 

kuno edited this page · 16 revisions

Pages 3

Clone this wiki locally

Initialization

var Ejabberd = require('ejabberd');
var e = new Ejabberd(dist, options);

Arguments

Name Type Description Default
dist String The distribution of os that ejabberd server is running on. The value of environment variable EJABBERD_DIST
options Object The options object See below
  • The possible value of options object
Key Type Description
checkerInterval Integer The time interval of ejabberd server status checker, in ms
restartTime Integer The waiting time when restart ejabberd server, in ms
pauseTime Integer The waiting time when execution command, in ms
debug Boolean Debug mode ?
sudo Boolean Use sudo to execute ejabberdctl commands ?
  • Note

You can also specify a env variable EJABBERDCTL_BIN to tell the absolute path of ejabberdctl binary, otherwise the return value of which ejabberdclt will be used.

Methods

addVhost


var promise = e.addVhost(host, config);

Arguments

Name Type Description Default
host String A virtual host address, like chat.example.com None
config Object The object contain all possible config value of a vhost See below
  • Possible value of config object
Key Type Description
host String The vhost's url
admins Array An array of username that will be admin of this vhost

Return Value

A Promise object

register


var promise = e.register(username, host, password);

Arguments

Name Type Description Default
username String user name None
host String a virtual host address, like chat.example.com None
password String password None

Return Value

A Promise object

addUsers (v0.2.2+)


var promise = e.addUsers(users, host);

Arguments

Name Type Description Default
users Array an array of user object, e.g {name:'blah', password: 'blah'} None
host String a virtual host address, like chat.example.com None

Return Value

A Promise object

unregister


var promise = e.unregister(username, host);

Arguments

Name Type Description Default
username String user name None
host String a virtual host address, like chat.example.com None

Return Value

A Promise object

removeUsers (v0.2.1+)


var promise = e.removeUsers(usernames, host);

Arguments

Name Type Description Default
usernames Array an array of user names None
host String a virtual host address, like chat.example.com None

Return Value

A Promise object

changePassword


var promise = e.changePassword(username, host, newPass);

Arguments

Name Type Description Default
username String user name None
host String a virtual host address, like chat.example.com None
newPass String new password None

Return Value

A Promise object

changeAllPasswords (v0.2.0+)


var promise = e.changeAllPasswords(username, hosts, newPass);

Arguments

Name Type Description Default
username String user name None
hosts String an array of virtual host address None
newPass String new password None

Return Value

A Promise object

restart


var promise = e.restart();

Arguments

Name Type Description Default

Return Value

A Promise object

Something went wrong with that request. Please try again.