summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-05-09 22:02:06 +0100
committerSadie Powell <sadie@witchery.services>2025-05-09 22:02:06 +0100
commit2cf8f003ce318997f3259ef1c8bd082d4569057a (patch)
tree6a4a2d089a8804da7fc7f85fdf8f573f5b5b6d4c
parent07f57b11083c3126e256dc381ab3646a01f71d66 (diff)
Allow using an account identifier in the anope.account RPC method.
-rw-r--r--docs/RPC/rpc_data.md2
-rw-r--r--modules/rpc/rpc_data.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/docs/RPC/rpc_data.md b/docs/RPC/rpc_data.md
index a42f7b5be..fddf19276 100644
--- a/docs/RPC/rpc_data.md
+++ b/docs/RPC/rpc_data.md
@@ -36,7 +36,7 @@ Retrieves information about the specified account.
Index | Description
----- | -----------
-0 | A nickname belonging to the account.
+0 | Either a nickname belonging to the account or an account identifier.
### Errors
diff --git a/modules/rpc/rpc_data.cpp b/modules/rpc/rpc_data.cpp
index c4ab43d69..dca1434db 100644
--- a/modules/rpc/rpc_data.cpp
+++ b/modules/rpc/rpc_data.cpp
@@ -173,7 +173,9 @@ public:
bool Run(RPC::ServiceInterface *iface, HTTP::Client *client, RPC::Request &request) override
{
- auto *na = NickAlias::Find(request.data[0]);
+ auto *na = request.data[0].is_pos_number_only()
+ ? NickAlias::FindId(Anope::Convert(request.data[0], 0))
+ : NickAlias::Find(request.data[0]);
if (!na)
{
request.Error(ERR_NO_SUCH_TARGET, "No such account");