From bb1f93f1508ebdd0a6bef227cf924229dd05497b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 17 Mar 2025 12:58:22 +0000 Subject: Switch RPC event registration to use the service system. --- include/modules/rpc.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/modules/rpc.h b/include/modules/rpc.h index 52d1d6492..719c459e8 100644 --- a/include/modules/rpc.h +++ b/include/modules/rpc.h @@ -21,9 +21,6 @@ namespace RPC class ServiceInterface; class Value; - /** Represents a list of registered events. */ - using Events = Anope::map; - /** Represents possible types of RPC value. */ using ValueUnion = std::variant; @@ -171,15 +168,17 @@ public: inline const auto &GetRoot() const { return this->root; } }; +#define RPC_EVENT "RPC::Event" + class RPC::Event + : public Service { private: - Anope::string event; size_t minparams; protected: - Event(const Anope::string& e, size_t mp = 0) - : event(e) + Event(Module *o, const Anope::string& e, size_t mp = 0) + : Service(o, RPC_EVENT, e) , minparams(mp) { } @@ -187,8 +186,6 @@ protected: public: virtual ~Event() = default; - const auto &GetEvent() const { return event; } - const auto &GetMinParams() const { return minparams; } virtual bool Run(ServiceInterface *iface, HTTPClient *client, Request &request) = 0; @@ -203,12 +200,6 @@ public: { } - virtual const Events &GetEvents() = 0; - - virtual bool Register(Event *event) = 0; - - virtual bool Unregister(Event *event) = 0; - virtual void Reply(Request &request) = 0; }; -- cgit