]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/main.h
4949f60dc28d5e1b4b7bb5be0cb38363b7f331fa
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / main.h
1 #ifndef __ST_MAIN__
2 #define __ST_MAIN__
3
4 #include "inspircd.h"
5 #include "modules.h"
6
7 /** If you make a change which breaks the protocol, increment this.
8  * If you  completely change the protocol, completely change the number.
9  *
10  * IMPORTANT: If you make changes, document your changes here, without fail:
11  * http://www.inspircd.org/wiki/List_of_protocol_changes_between_versions
12  *
13  * Failure to document your protocol changes will result in a painfully
14  * painful death by pain. You have been warned.
15  */
16 const long ProtocolVersion = 1105;
17
18 /** Forward declarations
19  */
20 class cmd_rconnect;
21 class SpanningTreeUtilities;
22 class TimeSyncTimer;
23 class CacheRefreshTimer;
24 class TreeServer;
25 class Link;
26
27 /** This is the main class for the spanningtree module
28  */
29 class ModuleSpanningTree : public Module
30 {
31         int line;
32         int NumServers;
33         unsigned int max_local;
34         unsigned int max_global;
35         cmd_rconnect* command_rconnect;
36         SpanningTreeUtilities* Utils;
37
38  public:
39         /** Timer for clock syncs
40          */
41         TimeSyncTimer *SyncTimer;
42
43         CacheRefreshTimer *RefreshTimer;
44
45         /** Constructor
46          */
47         ModuleSpanningTree(InspIRCd* Me);
48
49         /** Shows /LINKS
50          */
51         void ShowLinks(TreeServer* Current, userrec* user, int hops);
52
53         /** Counts local servers
54          */
55         int CountLocalServs();
56
57         /** Counts local and remote servers
58          */
59         int CountServs();
60
61         /** Handle LINKS command
62          */
63         void HandleLinks(const char** parameters, int pcnt, userrec* user);
64
65         /** Handle LUSERS command
66          */
67         void HandleLusers(const char** parameters, int pcnt, userrec* user);
68
69         /** Show MAP output to a user (recursive)
70          */
71         void ShowMap(TreeServer* Current, userrec* user, int depth, char matrix[128][80], float &totusers, float &totservers);
72
73         /** Handle remote MOTD
74          */
75         int HandleMotd(const char** parameters, int pcnt, userrec* user);
76
77         /** Handle remote ADMIN
78          */
79         int HandleAdmin(const char** parameters, int pcnt, userrec* user);
80
81         /** Handle remote STATS
82          */
83         int HandleStats(const char** parameters, int pcnt, userrec* user);
84
85         /** Handle MAP command
86          */
87         void HandleMap(const char** parameters, int pcnt, userrec* user);
88
89         /** Handle SQUIT
90          */
91         int HandleSquit(const char** parameters, int pcnt, userrec* user);
92
93         /** Handle TIME
94          */
95         int HandleTime(const char** parameters, int pcnt, userrec* user);
96
97         /** Handle remote WHOIS
98          */
99         int HandleRemoteWhois(const char** parameters, int pcnt, userrec* user);
100
101         /** Handle remote MODULES
102          */
103         int HandleModules(const char** parameters, int pcnt, userrec* user);
104
105         /** Ping all local servers
106          */
107         void DoPingChecks(time_t curtime);
108
109         /** Connect a server locally
110          */
111         void ConnectServer(Link* x);
112
113         /** Check if any servers are due to be autoconnected
114          */
115         void AutoConnectServers(time_t curtime);
116
117         /** Handle remote VERSON
118          */
119         int HandleVersion(const char** parameters, int pcnt, userrec* user);
120
121         /** Handle CONNECT
122          */
123         int HandleConnect(const char** parameters, int pcnt, userrec* user);
124
125         /** Send out time sync to all servers
126          */
127         void BroadcastTimeSync();
128
129         /** Returns oper-specific MAP information
130          */
131         const std::string MapOperInfo(TreeServer* Current);
132
133         /**
134          ** *** MODULE EVENTS ***
135          **/
136
137         virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line);
138         virtual void OnPostCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, CmdResult result, const std::string &original_line);
139         virtual void OnGetServerDescription(const std::string &servername,std::string &description);
140         virtual void OnUserInvite(userrec* source,userrec* dest,chanrec* channel);
141         virtual void OnPostLocalTopicChange(userrec* user, chanrec* chan, const std::string &topic);
142         virtual void OnWallops(userrec* user, const std::string &text);
143         virtual void OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
144         virtual void OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
145         virtual void OnBackgroundTimer(time_t curtime);
146         virtual void OnUserJoin(userrec* user, chanrec* channel);
147         virtual void OnChangeHost(userrec* user, const std::string &newhost);
148         virtual void OnChangeName(userrec* user, const std::string &gecos);
149         virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage);
150         virtual void OnUserConnect(userrec* user);
151         virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message);
152         virtual void OnUserPostNick(userrec* user, const std::string &oldnick);
153         virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason);
154         virtual void OnRemoteKill(userrec* source, userrec* dest, const std::string &reason);
155         virtual void OnRehash(userrec* user, const std::string &parameter);
156         virtual void OnOper(userrec* user, const std::string &opertype);
157         void OnLine(userrec* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason);
158         virtual void OnAddGLine(long duration, userrec* source, const std::string &reason, const std::string &hostmask);
159         virtual void OnAddZLine(long duration, userrec* source, const std::string &reason, const std::string &ipmask);
160         virtual void OnAddQLine(long duration, userrec* source, const std::string &reason, const std::string &nickmask);
161         virtual void OnAddELine(long duration, userrec* source, const std::string &reason, const std::string &hostmask);
162         virtual void OnDelGLine(userrec* source, const std::string &hostmask);
163         virtual void OnDelZLine(userrec* source, const std::string &ipmask);
164         virtual void OnDelQLine(userrec* source, const std::string &nickmask);
165         virtual void OnDelELine(userrec* source, const std::string &hostmask);
166         virtual void OnMode(userrec* user, void* dest, int target_type, const std::string &text);
167         virtual int OnStats(char statschar, userrec* user, string_list &results);
168         virtual void OnSetAway(userrec* user);
169         virtual void OnCancelAway(userrec* user);
170         virtual void ProtoSendMode(void* opaque, int target_type, void* target, const std::string &modeline);
171         virtual void ProtoSendMetaData(void* opaque, int target_type, void* target, const std::string &extname, const std::string &extdata);
172         virtual void OnEvent(Event* event);
173         virtual ~ModuleSpanningTree();
174         virtual Version GetVersion();
175         void Implements(char* List);
176         Priority Prioritize();
177 };
178
179 #endif