2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 namespace ServerProtocol
26 class BroadcastEventListener;
27 class LinkEventListener;
28 class SyncEventListener;
31 class ServerProtocol::BroadcastEventListener
32 : public Events::ModuleEventListener
35 BroadcastEventListener(Module* mod)
36 : ModuleEventListener(mod, "event/server-broadcast")
40 /** Fired when a channel message is being broadcast across the network.
41 * @param channel The channel which is having a message sent to it.
42 * @param server The server which might have a message broadcast to it.
43 * @return Either MOD_RES_ALLOW to always send the message to the server, MOD_RES_DENY to never
44 * send the message to the server or MOD_RES_PASSTHRU if no module handled the event.
46 virtual ModResult OnBroadcastMessage(Channel* channel, const Server* server) { return MOD_RES_PASSTHRU; }
49 class ServerProtocol::LinkEventListener
50 : public Events::ModuleEventListener
53 LinkEventListener(Module* mod)
54 : ModuleEventListener(mod, "event/server-link")
58 /** Fired when a server finishes burst
59 * @param server Server that recently linked and finished burst
61 virtual void OnServerLink(const Server* server) { }
63 /** Fired when a server splits
64 * @param server Server that split
66 virtual void OnServerSplit(const Server* server) { }
69 class ServerProtocol::SyncEventListener
70 : public Events::ModuleEventListener
73 SyncEventListener(Module* mod)
74 : ModuleEventListener(mod, "event/server-sync")
78 /** Allows modules to synchronize user metadata during a netburst. This will
79 * be called for every user visible on your side of the burst.
80 * @param user The user being synchronized.
81 * @param server The target of the burst.
83 virtual void OnSyncUser(User* user, ProtocolServer& server) { }
85 /** Allows modules to synchronize channel metadata during a netburst. This will
86 * be called for every channel visible on your side of the burst.
87 * @param chan The channel being synchronized.
88 * @param server The target of the burst.
90 virtual void OnSyncChannel(Channel* chan, ProtocolServer& server) { }
92 /** Allows modules to synchronize network metadata during a netburst.
93 * @param server The target of the burst.
95 virtual void OnSyncNetwork(ProtocolServer& server) { }
98 /** Compatibility struct for <3.3.0 modules. */
99 class ServerEventListener
100 : public ServerProtocol::BroadcastEventListener
101 , public ServerProtocol::LinkEventListener
102 , public ServerProtocol::SyncEventListener
105 ServerEventListener(Module* mod)
106 : ServerProtocol::BroadcastEventListener(mod)
107 , ServerProtocol::LinkEventListener(mod)
108 , ServerProtocol::SyncEventListener(mod)