diff options
Diffstat (limited to 'include/modules/server.h')
-rw-r--r-- | include/modules/server.h | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/include/modules/server.h b/include/modules/server.h index f9907ef26..6bd10b3e3 100644 --- a/include/modules/server.h +++ b/include/modules/server.h @@ -21,11 +21,19 @@ #include "event.h" -class ServerEventListener : public Events::ModuleEventListener +namespace ServerProtocol +{ + class BroadcastEventListener; + class LinkEventListener; + class SyncEventListener; +} + +class ServerProtocol::BroadcastEventListener + : public Events::ModuleEventListener { public: - ServerEventListener(Module* mod) - : ModuleEventListener(mod, "event/server") + BroadcastEventListener(Module* mod) + : ModuleEventListener(mod, "event/server-broadcast") { } @@ -36,6 +44,16 @@ class ServerEventListener : public Events::ModuleEventListener * send the message to the server or MOD_RES_PASSTHRU if no module handled the event. */ virtual ModResult OnBroadcastMessage(Channel* channel, const Server* server) { return MOD_RES_PASSTHRU; } +}; + +class ServerProtocol::LinkEventListener + : public Events::ModuleEventListener +{ + public: + LinkEventListener(Module* mod) + : ModuleEventListener(mod, "event/server-link") + { + } /** Fired when a server finishes burst * @param server Server that recently linked and finished burst @@ -46,6 +64,16 @@ class ServerEventListener : public Events::ModuleEventListener * @param server Server that split */ virtual void OnServerSplit(const Server* server) { } +}; + +class ServerProtocol::SyncEventListener + : public Events::ModuleEventListener +{ + public: + SyncEventListener(Module* mod) + : ModuleEventListener(mod, "event/server-sync") + { + } /** Allows modules to synchronize user metadata during a netburst. This will * be called for every user visible on your side of the burst. @@ -66,3 +94,18 @@ class ServerEventListener : public Events::ModuleEventListener */ virtual void OnSyncNetwork(ProtocolServer& server) { } }; + +/** Compatibility struct for <3.3.0 modules. */ +class ServerEventListener + : public ServerProtocol::BroadcastEventListener + , public ServerProtocol::LinkEventListener + , public ServerProtocol::SyncEventListener +{ + public: + ServerEventListener(Module* mod) + : ServerProtocol::BroadcastEventListener(mod) + , ServerProtocol::LinkEventListener(mod) + , ServerProtocol::SyncEventListener(mod) + { + } +}; |