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