summaryrefslogtreecommitdiff
path: root/include
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 /include
parent85fbc500d8bcc83a26f3227c90cb82896b767d62 (diff)
Switch RPC event registration to use the service system.
Diffstat (limited to 'include')
-rw-r--r--include/modules/rpc.h19
1 files changed, 5 insertions, 14 deletions
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<Event *>;
-
/** Represents possible types of RPC value. */
using ValueUnion = std::variant<Array, Map, Anope::string, std::nullptr_t, bool, double, int64_t, uint64_t>;
@@ -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;
};