Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/VibeDevelopers/atheme. Modified fork of atheme IRC Services www.vibetalk.net
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128Atheme JSONRPC interface-----------------------
The modules/transport/jsonrpc/main module provides an JSONRPC interface to Atheme.
Atheme does not use HTTP authentication, instead using its own system withauthentication cookies.
JSONRPC is documented in http://json-rpc.org/. It's an exchange of JSON objectswith a method, parameters, and id. The available methods and the parametersthey take are documented below:
Methods from modules/transport/jsonrpc:
/* * atheme.login * * Parameters: * [ account name, password, source ip (optional) ] * * Outputs:
* If there is an error, an error object is returned with 'code' set to * one of the codes below, and 'message' to its corresponding message. * fault 1 - insufficient parameters * fault 3 - account is not registered * fault 5 - invalid username and password * fault 6 - account is frozen * If there is no error, the 'result' property of the returned object has * the authcookie
* Side Effects: * an authcookie ticket is created for the myuser_t. * the user's lastlogin is updated */
Source ip is logged with the request, it does not need to be an IP address.
For web interfaces, the resulting authcookie can be stored in a HTTP cookie,avoiding password storage.
The authcookie will be valid for one hour or until Atheme shuts down.
/* * atheme.logout * * Parameters: * [ authcookie, account name ] * * Outputs: * If there is an error, an error object is returned with 'code' set to * one of the codes below, and 'message' to its corresponding message. * fault 1 - insufficient parameters * fault 3 - unknown user * fault 5 - validation failed * If there is no error, the 'result' property of the returned object has * a success message
* Side Effects: * an authcookie ticket is destroyed. */
/* * atheme.command * * Params: * [ authcookie, account name, source ip, service name, command name, * ... ] - The array values after the command name are all parameters * * Outputs: * Depends on command. Either an error object with error code and message * is returned, or a result string with the command's output. * * Side Effects: * command is executed */
/* * atheme.privset * * Inputs: * [ authcookie, account name ] * * Outputs: * Privset for user, or error message **/
Authcookie and account name specify authentication for the command; authcookiecan be specified as '.' to execute a command without a login.Source ip is logged with the request, it does not need to be an IP address.Service name is the nick of the service.Command name is the command to be executed. Subcommand names are parameters.Parameters are specified in the same order as on IRC with mostly one distinctentity per parameter. Exceptions to this are for example operserv akill (twoparameters), operserv rwatch (one parameter) and nickserv set property (twoparameters in all cases).
Failed commands return an appropriate fault code with the first descriptivestring that would be returned on IRC. Most successful commands return alldescriptive text that would be returned on IRC; some, such as chanserv getkey,return only a result string.
For experimenting with parameters and results you can use contrib/os_testcmd.Usage is /os testcmd <servicename> <commandname> [parameters] where theparameters are separated with semicolons.
Other methods:
See the source code, modules/transport/jsonrpc/main.c.
Fault codes:
1 : fault_needmoreparams. Not enough parameters2 : fault_badparams. Parameters invalid somehow3 : fault_nosuch_source. Source account does not exist4 : fault_nosuch_target. Target does not exist5 : fault_authfail. Bad password or authcookie6 : fault_noprivs. Permission denied (various, but not bad password/authcookie)7 : fault_nosuch_key. Requested element on target does not exist8 : fault_alreadyexists. Something conflicting already exists9 : fault_toomany. Too many of something10 : fault_emailfail. Sending email failed11 : fault_notverified. Account not verified12 : fault_nochange. Object is already in requested state13 : fault_already_authed. Already logged in14 : fault_unimplemented. Function not implemented