summaryrefslogtreecommitdiff
path: root/docs/RPC
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-04-19 22:31:49 +0100
committerSadie Powell <sadie@witchery.services>2025-04-19 22:31:49 +0100
commitc8b38197670965c18df603a5a4329f6f583b77d7 (patch)
tree6522f9517cd23e93debd7524a1f989ee6575a5d6 /docs/RPC
parente6a1982922c2b8031c14381491a435e4c87b537c (diff)
Add the anope.account and anope.listAccounts RPC events.
Diffstat (limited to 'docs/RPC')
-rw-r--r--docs/RPC/jsonrpc.js24
-rw-r--r--docs/RPC/rpc_data.md125
2 files changed, 149 insertions, 0 deletions
diff --git a/docs/RPC/jsonrpc.js b/docs/RPC/jsonrpc.js
index 357cbc844..8f15a4ee8 100644
--- a/docs/RPC/jsonrpc.js
+++ b/docs/RPC/jsonrpc.js
@@ -45,6 +45,30 @@ class AnopeRPC {
}
/**
+ * Retrieves a list of accounts.
+ *
+ * Requires the rpc_data module to be loaded.
+ *
+ * @param {string} The level of detail to request.
+ * @returns {array} An array of account names.
+ */
+ listAccounts(detail = "name") {
+ return this.run("anope.listAccounts", detail);
+ }
+
+ /**
+ * Retrieves information about the specified account.
+ *
+ * Requires the rpc_data module to be loaded.
+ *
+ * @param {string} name The name of the account.
+ * @returns {object} An object containing information about the account.
+ */
+ account(name) {
+ return this.run("anope.account", name);
+ }
+
+ /**
* Retrieves a list of channels.
*
* Requires the rpc_data module to be loaded.
diff --git a/docs/RPC/rpc_data.md b/docs/RPC/rpc_data.md
index 7bb8d18c2..03bc9fa0b 100644
--- a/docs/RPC/rpc_data.md
+++ b/docs/RPC/rpc_data.md
@@ -1,5 +1,130 @@
# Anope `rpc_data` RPC interface
+## `anope.listAccounts`
+
+Lists all accounts that exist on the network.
+
+### Parameters
+
+Index | Description
+----- | -----------
+0 | If specified then the level of detail to retrieve. Can be set to "full" to retrieve all information or "name" to just retrieve the account names. Defaults to "name".
+
+### Errors
+
+Code | Description
+------ | -----------
+-32099 | The specified detail level does not exist.
+
+### Result
+
+If the detail level is not specified or is "name" then an array of account names.
+
+If the detail level is "full" then a mapping of account names to information about the account. See `anope.account` for more information on the data structure.
+
+#### Example
+
+```json
+["account1", "account2", "account3"]
+```
+
+## `anope.account`
+
+Retrieves information about the specified account.
+
+### Parameters
+
+Index | Description
+----- | -----------
+0 | A nickname belonging to the account.
+
+### Errors
+
+Code | Description
+------ | -----------
+-32099 | The specified account does not exist.
+
+### Result
+
+Returns a map containing information about the account.
+
+Key | Type | Description
+--- | ---- | -----------
+display | string | The display nickname of the account.
+email | string or null | The email address associated with the account or null if one has not been specified.
+extensions | map | A key-value map of the extensions set on this account by modules.
+language | string or null | The language associated with the account or null if the account uses the default language.
+lastmail | int | The time at which an email was last sent for this account.
+nicks | map | Information about nicknames that belong to the account keyed by the nickname.
+nicks.\*.extensions | map | A key-value map of the extensions set on this nickname by modules.
+nicks.\*.lastseen | int | The time at which this nickname was last used.
+nicks.\*.registered | int | The time at which this nickname was registered.
+nicks.\*.vhost | map or null | The vhost associated with the account or null if the user has no vhost.
+nicks.\*.vhost.created | int | The time at which the vhost was created.
+nicks.\*.vhost.creator | string | The nickname of the creator of the vhost.
+nicks.\*.vhost.host | string | The host segment of the vhost.
+nicks.\*.vhost.ident | string or null | The ident segment of the vhost or null if there is not one.
+nicks.\*.vhost.mask | string | The user@host or host mask of the vhost.
+opertype | map or null | The oper type associated with the account or null if they are not a services operator.
+opertype.commands | array[string] | The commands that the services operator type can use.
+opertype.name | string | The name of the services operator type.
+opertype.privileges | array[string] | The privileges that the services operator type has.
+registered | int | The time at which the account was registered.
+uniqueid | uint | The unique immutable identifier of the account.
+users | array[string] | The IRC users who are currently logged in to this account.
+
+#### Example
+
+```json
+{
+ "display": "foo",
+ "email": "example@example.com",
+ "extensions": {
+ "AUTOOP": true,
+ "HIDE_EMAIL": true,
+ "HIDE_MASK": true,
+ "MEMO_RECEIVE": true,
+ "MEMO_SIGNON": true,
+ "NS_PRIVATE": true,
+ "PROTECT": true,
+ "PROTECT_AFTER": 69
+ },
+ "language": null,
+ "lastmail": 1745071858,
+ "nicks": {
+ "foo": {
+ "extensions": {
+ "NS_NO_EXPIRE": true
+ },
+ "lastseen": 1745074153,
+ "registered": 1745071857,
+ "vhost": null
+ },
+ "bar": {
+ "extensions": {},
+ "lastseen": 1745072602,
+ "registered": 1745071857,
+ "vhost": {
+ "created": 1745072653,
+ "creator": "foo",
+ "host": "bar.baz",
+ "ident": "foo",
+ "mask": "foo@bar.baz"
+ }
+ }
+ },
+ "opertype": {
+ "commands": ["hostserv/*", "operserv/session"],
+ "name": "Helper",
+ "privileges": ["chanserv/no-register-limit"]
+ },
+ "registered": 1745071857,
+ "uniqueid": 11085415958920757000,
+ "users": [
+ "foo"
+ ]
+}
+```
## `anope.listChannels`
Lists all channels that exist on the network.