summaryrefslogtreecommitdiff
path: root/modules/rpc/rpc_main.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-17 12:58:22 +0000
committerSadie Powell <sadie@witchery.services>2025-03-17 12:58:22 +0000
commitbb1f93f1508ebdd0a6bef227cf924229dd05497b (patch)
tree807223c968d79a37c125cb2b5f41248f5ed6a45a /modules/rpc/rpc_main.cpp
parent85fbc500d8bcc83a26f3227c90cb82896b767d62 (diff)
Switch RPC event registration to use the service system.
Diffstat (limited to 'modules/rpc/rpc_main.cpp')
-rw-r--r--modules/rpc/rpc_main.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/modules/rpc/rpc_main.cpp b/modules/rpc/rpc_main.cpp
index 68bcf9a04..4fd40697d 100644
--- a/modules/rpc/rpc_main.cpp
+++ b/modules/rpc/rpc_main.cpp
@@ -61,8 +61,8 @@ class CommandRPCEvent final
: public RPC::Event
{
public:
- CommandRPCEvent()
- : RPC::Event("command")
+ CommandRPCEvent(Module *o)
+ : RPC::Event(o, "command")
{
}
@@ -118,8 +118,8 @@ class CheckAuthenticationRPCEvent final
: public RPC::Event
{
public:
- CheckAuthenticationRPCEvent()
- : RPC::Event("checkAuthentication")
+ CheckAuthenticationRPCEvent(Module *o)
+ : RPC::Event(o, "checkAuthentication")
{
}
@@ -145,8 +145,8 @@ class StatsRPCEvent final
: public RPC::Event
{
public:
- StatsRPCEvent()
- : RPC::Event("stats")
+ StatsRPCEvent(Module *o)
+ : RPC::Event(o, "stats")
{
}
@@ -178,25 +178,14 @@ private:
public:
ModuleRPCMain(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, EXTRA | VENDOR)
+ , commandrpcevent(this)
+ , checkauthenticationrpcevent(this)
+ , statsrpcevent(this)
{
me = this;
if (!RPC::service)
throw ModuleException("Unable to find RPC interface, is jsonrpc/xmlrpc loaded?");
-
- RPC::service->Register(&commandrpcevent);
- RPC::service->Register(&checkauthenticationrpcevent);
- RPC::service->Register(&statsrpcevent);
- }
-
- ~ModuleRPCMain() override
- {
- if (!RPC::service)
- return;
-
- RPC::service->Unregister(&commandrpcevent);
- RPC::service->Unregister(&checkauthenticationrpcevent);
- RPC::service->Unregister(&statsrpcevent);
}
};