]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/configreader.h
Add <options:exemptchanops> support to m_censor and m_blockcaps, and tidy up the...
[user/henk/code/inspircd.git] / include / configreader.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 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 INSPIRCD_CONFIGREADER
15 #define INSPIRCD_CONFIGREADER
16
17 /* handy defines */
18
19 /** Determines if a channel op is exempt from given mode m,
20  * in config of server instance s. 
21  */
22 #define CHANOPS_EXEMPT(s, m) (s->Config->ExemptChanOps[(unsigned char)m])
23
24 #include <sstream>
25 #include <string>
26 #include <vector>
27 #include <map>
28 #include "inspircd.h"
29 #include "globals.h"
30 #include "modules.h"
31 #include "socketengine.h"
32 #include "socket.h"
33
34 /* Required forward definitions */
35 class ServerConfig;
36 class InspIRCd;
37 class BufferedSocket;
38
39 /** Types of data in the core config
40  */
41 enum ConfigDataType
42 {
43         DT_NOTHING       = 0,           /* No data */
44         DT_INTEGER       = 1,           /* Integer */
45         DT_CHARPTR       = 2,           /* Char pointer */
46         DT_BOOLEAN       = 3,           /* Boolean */
47         DT_HOSTNAME      = 4,           /* Hostname syntax */
48         DT_NOSPACES      = 5,           /* No spaces */
49         DT_IPADDRESS     = 6,           /* IP address (v4, v6) */
50         DT_CHANNEL       = 7,           /* Channel name */
51         DT_ALLOW_WILD    = 64,          /* Allow wildcards/CIDR in DT_IPADDRESS */
52         DT_ALLOW_NEWLINE = 128          /* New line characters allowed in DT_CHARPTR */
53 };
54
55 /** Holds a config value, either string, integer or boolean.
56  * Callback functions receive one or more of these, either on
57  * their own as a reference, or in a reference to a deque of them.
58  * The callback function can then alter the values of the ValueItem
59  * classes to validate the settings.
60  */
61 class ValueItem
62 {
63         /** Actual data */
64         std::string v;
65  public:
66         /** Initialize with an int */
67         ValueItem(int value);
68         /** Initialize with a bool */
69         ValueItem(bool value);
70         /** Initialize with a char pointer */
71         ValueItem(const char* value);
72         /** Change value to a char pointer */
73         void Set(const char* val);
74         /** Change value to an int */
75         void Set(int value);
76         /** Get value as an int */
77         int GetInteger();
78         /** Get value as a string */
79         char* GetString();
80         /** Get value as a bool */
81         bool GetBool();
82 };
83
84 /** The base class of the container 'ValueContainer'
85  * used internally by the core to hold core values.
86  */
87 class ValueContainerBase
88 {
89  public:
90         /** Constructor */
91         ValueContainerBase() { }
92         /** Destructor */
93         virtual ~ValueContainerBase() { }
94 };
95
96 /** ValueContainer is used to contain pointers to different
97  * core values such as the server name, maximum number of
98  * clients etc.
99  * It is specialized to hold a data type, then pointed at
100  * a value in the ServerConfig class. When the value has been
101  * read and validated, the Set method is called to write the
102  * value safely in a type-safe manner.
103  */
104 template<typename T> class ValueContainer : public ValueContainerBase
105 {
106         /** Contained item */
107         T val;
108  public:
109
110         /** Initialize with nothing */
111         ValueContainer()
112         {
113                 val = NULL;
114         }
115
116         /** Initialize with a value of type T */
117         ValueContainer(T Val)
118         {
119                 val = Val;
120         }
121
122         /** Change value to type T of size s */
123         void Set(T newval, size_t s)
124         {
125                 memcpy(val, newval, s);
126         }
127 };
128
129 /** A specialization of ValueContainer to hold a pointer to a bool
130  */
131 typedef ValueContainer<bool*> ValueContainerBool;
132
133 /** A specialization of ValueContainer to hold a pointer to
134  * an unsigned int
135  */
136 typedef ValueContainer<unsigned int*> ValueContainerUInt;
137
138 /** A specialization of ValueContainer to hold a pointer to
139  * a char array.
140  */
141 typedef ValueContainer<char*> ValueContainerChar;
142
143 /** A specialization of ValueContainer to hold a pointer to
144  * an int
145  */
146 typedef ValueContainer<int*> ValueContainerInt;
147
148 /** A set of ValueItems used by multi-value validator functions
149  */
150 typedef std::deque<ValueItem> ValueList;
151
152 /** A callback for validating a single value
153  */
154 typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, ValueItem&);
155 /** A callback for validating multiple value entries
156  */
157 typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, ValueList&, int*);
158 /** A callback indicating the end of a group of entries
159  */
160 typedef bool (*MultiNotify)(ServerConfig* conf, const char*);
161
162 /** Holds a core configuration item and its callbacks
163  */
164 struct InitialConfig
165 {
166         /** Tag name */
167         const char* tag;
168         /** Value name */
169         const char* value;
170         /** Default, if not defined */
171         const char* default_value;
172         /** Value containers */
173         ValueContainerBase* val;
174         /** Data types */
175         ConfigDataType datatype;
176         /** Validation function */
177         Validator validation_function;
178 };
179
180 /** Holds a core configuration item and its callbacks
181  * where there may be more than one item
182  */
183 struct MultiConfig
184 {
185         /** Tag name */
186         const char*     tag;
187         /** One or more items within tag */
188         const char*     items[18];
189         /** One or more defaults for items within tags */
190         const char* items_default[18];
191         /** One or more data types */
192         int             datatype[18];
193         /** Initialization function */
194         MultiNotify     init_function;
195         /** Validation function */
196         MultiValidator  validation_function;
197         /** Completion function */
198         MultiNotify     finish_function;
199 };
200
201 /** A set of oper types
202  */
203 typedef std::map<irc::string,char*> opertype_t;
204
205 /** A Set of oper classes
206  */
207 typedef std::map<irc::string,char*> operclass_t;
208
209
210 /** This class holds the bulk of the runtime configuration for the ircd.
211  * It allows for reading new config values, accessing configuration files,
212  * and storage of the configuration data needed to run the ircd, such as
213  * the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
214  */
215 class CoreExport ServerConfig : public Extensible
216 {
217   private:
218         /** Creator/owner pointer
219          */
220         InspIRCd* ServerInstance;
221
222         /** This variable holds the names of all
223          * files included from the main one. This
224          * is used to make sure that no files are
225          * recursively included.
226          */
227         std::vector<std::string> include_stack;
228
229         /** This private method processes one line of
230          * configutation, appending errors to errorstream
231          * and setting error if an error has occured.
232          */
233         bool ParseLine(ConfigDataHash &target, std::string &line, long &linenumber, std::ostringstream &errorstream);
234
235         /** Check that there is only one of each configuration item
236          */
237         bool CheckOnce(const char* tag);
238
239  public:
240
241         /** Process an include executable directive
242          */
243         bool DoPipe(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream);
244
245         /** Process an include file directive
246          */
247         bool DoInclude(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream);
248
249         User* RehashUser;
250
251         std::string RehashParameter;
252
253         std::ostringstream errstr;
254
255         ConfigDataHash newconfig;
256
257         std::map<std::string, std::istream*> IncludedFiles;
258
259         std::map<std::string, bool> CompletedFiles;
260
261         size_t TotalDownloaded;
262         size_t FileErrors;
263
264         /** Used to indicate who we announce invites to on a channel */
265         enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC };
266
267         /** Pointer to function that validates dns server addresses (can be changed depending on platform) */
268         Validator DNSServerValidator;
269
270         InspIRCd* GetInstance();
271
272         int DoDownloads();
273           
274         /** This holds all the information in the config file,
275          * it's indexed by tag name to a vector of key/values.
276          */
277         ConfigDataHash config_data;
278
279         /** Max number of WhoWas entries per user.
280          */
281         int WhoWasGroupSize;
282
283         /** Max number of cumulative user-entries in WhoWas.
284          *  When max reached and added to, push out oldest entry FIFO style.
285          */
286         int WhoWasMaxGroups;
287
288         /** Max seconds a user is kept in WhoWas before being pruned.
289          */
290         int WhoWasMaxKeep;
291
292         /** Holds the server name of the local server
293          * as defined by the administrator.
294          */
295         char ServerName[MAXBUF];
296
297         /** Notice to give to users when they are Xlined
298          */
299         char MoronBanner[MAXBUF];
300         
301         /* Holds the network name the local server
302          * belongs to. This is an arbitary field defined
303          * by the administrator.
304          */
305         char Network[MAXBUF];
306
307         /** Holds the description of the local server
308          * as defined by the administrator.
309          */
310         char ServerDesc[MAXBUF];
311
312         /** Holds the admin's name, for output in
313          * the /ADMIN command.
314          */
315         char AdminName[MAXBUF];
316
317         /** Holds the email address of the admin,
318          * for output in the /ADMIN command.
319          */
320         char AdminEmail[MAXBUF];
321
322         /** Holds the admin's nickname, for output
323          * in the /ADMIN command
324          */
325         char AdminNick[MAXBUF];
326
327         /** The admin-configured /DIE password
328          */
329         char diepass[MAXBUF];
330
331         /** The admin-configured /RESTART password
332          */
333         char restartpass[MAXBUF];
334
335         /** The hash method for *BOTH* the die and restart passwords.
336          */
337         char powerhash[MAXBUF];
338
339         /** The pathname and filename of the message of the
340          * day file, as defined by the administrator.
341          */
342         char motd[MAXBUF];
343
344         /** The pathname and filename of the rules file,
345          * as defined by the administrator.
346          */
347         char rules[MAXBUF];
348
349         /** The quit prefix in use, or an empty string
350          */
351         char PrefixQuit[MAXBUF];
352
353         /** The quit suffix in use, or an empty string
354          */
355         char SuffixQuit[MAXBUF];
356
357         /** The fixed quit message in use, or an empty string
358          */
359         char FixedQuit[MAXBUF];
360
361         /** The part prefix in use, or an empty string
362          */
363         char PrefixPart[MAXBUF];
364
365         /** The part suffix in use, or an empty string
366          */
367         char SuffixPart[MAXBUF];
368
369         /** The fixed part message in use, or an empty string
370          */
371         char FixedPart[MAXBUF];
372
373         /** The last string found within a <die> tag, or
374          * an empty string.
375          */
376         char DieValue[MAXBUF];
377
378         /** The DNS server to use for DNS queries
379          */
380         char DNSServer[MAXBUF];
381
382         /** This variable contains a space-seperated list
383          * of commands which are disabled by the
384          * administrator of the server for non-opers.
385          */
386         char DisabledCommands[MAXBUF];
387
388         /** The full path to the modules directory.
389          * This is either set at compile time, or
390          * overridden in the configuration file via
391          * the <options> tag.
392          */
393         char ModPath[1024];
394
395         /** The full pathname to the executable, as
396          * given in argv[0] when the program starts.
397          */
398         char MyExecutable[1024];
399
400         /** The file handle of the logfile. If this
401          * value is NULL, the log file is not open,
402          * probably due to a permissions error on
403          * startup (this should not happen in normal
404          * operation!).
405          */
406         FILE *log_file;
407
408         /** If this value is true, the owner of the
409          * server specified -nofork on the command
410          * line, causing the daemon to stay in the
411          * foreground.
412          */
413         bool nofork;
414         
415         /** If this value if true then all log
416          * messages will be output, regardless of
417          * the level given in the config file.
418          * This is set with the -debug commandline
419          * option.
420          */
421         bool forcedebug;
422         
423         /** If this is true then log output will be
424          * written to the logfile. This is the default.
425          * If you put -nolog on the commandline then
426          * the logfile will not be written.
427          * This is meant to be used in conjunction with
428          * -debug for debugging without filling up the
429          * hard disk.
430          */
431         bool writelog;
432
433         /** If this value is true, halfops have been
434          * enabled in the configuration file.
435          */
436         bool AllowHalfop;
437
438         /** If this is set to true, then mode lists (e.g
439          * MODE #chan b) are hidden from unprivileged
440          * users.
441          */
442         bool HideModeLists[256];
443
444         /** If this is set to true, then channel operators
445          * are exempt from this channel mode. Used for +Sc etc.
446          */
447         bool ExemptChanOps[256];
448
449         /** The number of seconds the DNS subsystem
450          * will wait before timing out any request.
451          */
452         int dns_timeout;
453
454         /** The size of the read() buffer in the user
455          * handling code, used to read data into a user's
456          * recvQ.
457          */
458         int NetBufferSize;
459
460         /** The value to be used for listen() backlogs
461          * as default.
462          */
463         int MaxConn;
464
465         /** The soft limit value assigned to the irc server.
466          * The IRC server will not allow more than this
467          * number of local users.
468          */
469         unsigned int SoftLimit;
470
471         /** Maximum number of targets for a multi target command
472          * such as PRIVMSG or KICK
473          */
474         unsigned int MaxTargets;
475
476         /** The maximum number of /WHO results allowed
477          * in any single /WHO command.
478          */
479         int MaxWhoResults;
480
481         /** True if the DEBUG loglevel is selected.
482          */
483         int debugging;
484
485         /** The loglevel in use by the IRC server
486          */
487         int LogLevel;
488
489         /** How many seconds to wait before exiting
490          * the program when /DIE is correctly issued.
491          */
492         int DieDelay;
493
494         /** True if we're going to hide netsplits as *.net *.split for non-opers
495          */
496         bool HideSplits;
497
498         /** True if we're going to hide ban reasons for non-opers (e.g. G-Lines,
499          * K-Lines, Z-Lines)
500          */
501         bool HideBans;
502
503         /** Announce invites to the channel with a server notice
504          */
505         InviteAnnounceState AnnounceInvites;
506
507         /** If this is enabled then operators will
508          * see invisible (+i) channels in /whois.
509          */
510         bool OperSpyWhois;
511
512         /** Set to a non-empty string to obfuscate the server name of users in WHOIS
513          */
514         char HideWhoisServer[MAXBUF];
515
516         /** Set to a non empty string to obfuscate nicknames prepended to a KILL.
517          */
518         char HideKillsServer[MAXBUF];
519
520         /** The MOTD file, cached in a file_cache type.
521          */
522         file_cache MOTD;
523
524         /** The RULES file, cached in a file_cache type.
525          */
526         file_cache RULES;
527
528         /** The full pathname and filename of the PID
529          * file as defined in the configuration.
530          */
531         char PID[1024];
532
533         /** The connect classes in use by the IRC server.
534          */
535         ClassVector Classes;
536
537         /** A list of the classes for listening client ports
538          */
539         std::vector<ListenSocket*> ports;
540
541         /** A list of ports claimed by IO Modules
542          */
543         std::map<int,Module*> IOHookModule;
544
545         std::map<BufferedSocket*, Module*> SocketIOHookModule;
546
547         /** The 005 tokens of this server (ISUPPORT)
548          * populated/repopulated upon loading or unloading
549          * modules.
550          */
551         std::string data005;
552
553         /** isupport strings
554          */
555         std::vector<std::string> isupport;
556
557         /** STATS characters in this list are available
558          * only to operators.
559          */
560         char UserStats[MAXBUF];
561         
562         /** The path and filename of the ircd.log file
563          */
564         std::string logpath;
565
566         /** Default channel modes
567          */
568         char DefaultModes[MAXBUF];
569
570         /** Custom version string, which if defined can replace the system info in VERSION.
571          */
572         char CustomVersion[MAXBUF];
573
574         /** List of u-lined servers
575          */
576         std::map<irc::string, bool> ulines;
577
578         /** Max banlist sizes for channels (the std::string is a glob)
579          */
580         std::map<std::string, int> maxbans;
581
582         /** Directory where the inspircd binary resides
583          */
584         std::string MyDir;
585
586         /** If set to true, no user DNS lookups are to be performed
587          */
588         bool NoUserDns;
589
590         /** If set to true, provide syntax hints for unknown commands
591          */
592         bool SyntaxHints;
593
594         /** If set to true, users appear to quit then rejoin when their hosts change.
595          * This keeps clients synchronized properly.
596          */
597         bool CycleHosts;
598
599         /** If set to true, prefixed channel NOTICEs and PRIVMSGs will have the prefix
600          *  added to the outgoing text for undernet style msg prefixing.
601          */
602         bool UndernetMsgPrefix;
603
604         /** If set to true, the full nick!user@host will be shown in the TOPIC command
605          * for who set the topic last. If false, only the nick is shown.
606          */
607         bool FullHostInTopic;
608
609         /** All oper type definitions from the config file
610          */
611         opertype_t opertypes;
612
613         /** All oper class definitions from the config file
614          */
615         operclass_t operclass;
616
617         /** Saved argv from startup
618          */
619         char** argv;
620
621         /** Saved argc from startup
622          */
623         int argc;
624
625         /** Max channels per user
626          */
627         unsigned int MaxChans;
628
629         /** Oper max channels per user
630          */
631         unsigned int OperMaxChans;
632
633         /** TS6-like server ID.
634          * NOTE: 000...999 are usable for InspIRCd servers. This
635          * makes code simpler. 0AA, 1BB etc with letters are reserved
636          * for services use.
637          */
638         char sid[MAXBUF];
639
640         /** True if we have been told to run the testsuite from the commandline,
641          * rather than entering the mainloop.
642          */
643         bool TestSuite;
644
645         /** Construct a new ServerConfig
646          */
647         ServerConfig(InspIRCd* Instance);
648
649         /** Clears the include stack in preperation for a Read() call.
650          */
651         void ClearStack();
652
653         /** Get server ID as string with required leading zeroes
654          */
655         std::string GetSID();
656
657         /** Update the 005 vector
658          */
659         void Update005();
660
661         /** Send the 005 numerics (ISUPPORT) to a user
662          */
663         void Send005(User* user);
664
665         /** Read the entire configuration into memory
666          * and initialize this class. All other methods
667          * should be used only by the core.
668          */
669         void Read(bool bail, User* user);
670
671         /** Read a file into a file_cache object
672          */
673         bool ReadFile(file_cache &F, const char* fname);
674
675         /** Report a configuration error given in errormessage.
676          * @param bail If this is set to true, the error is sent to the console, and the program exits
677          * @param user If this is set to a non-null value, and bail is false, the errors are spooled to
678          * this user as SNOTICEs.
679          * If the parameter is NULL, the messages are spooled to all opers.
680          */
681         void ReportConfigError(const std::string &errormessage, bool bail, User* user);
682
683         /** Load 'filename' into 'target', with the new config parser everything is parsed into
684          * tag/key/value at load-time rather than at read-value time.
685          */
686         bool LoadConf(ConfigDataHash &target, FILE* &conf, const char* filename, std::ostringstream &errorstream);
687
688         /** Load 'filename' into 'target', with the new config parser everything is parsed into
689          * tag/key/value at load-time rather than at read-value time.
690          */
691         bool LoadConf(ConfigDataHash &target, FILE* &conf, const std::string &filename, std::ostringstream &errorstream);
692         
693         /* Both these return true if the value existed or false otherwise */
694         
695         /** Writes 'length' chars into 'result' as a string
696          */
697         bool ConfValue(ConfigDataHash &target, const char* tag, const char* var, int index, char* result, int length, bool allow_linefeeds = false);
698         /** Writes 'length' chars into 'result' as a string
699          */
700         bool ConfValue(ConfigDataHash &target, const char* tag, const char* var, const char* default_value, int index, char* result, int length, bool allow_linefeeds = false);
701
702         /** Writes 'length' chars into 'result' as a string
703          */
704         bool ConfValue(ConfigDataHash &target, const std::string &tag, const std::string &var, int index, std::string &result, bool allow_linefeeds = false);
705         /** Writes 'length' chars into 'result' as a string
706          */
707         bool ConfValue(ConfigDataHash &target, const std::string &tag, const std::string &var, const std::string &default_value, int index, std::string &result, bool allow_linefeeds = false);
708         
709         /** Tries to convert the value to an integer and write it to 'result'
710          */
711         bool ConfValueInteger(ConfigDataHash &target, const char* tag, const char* var, int index, int &result);
712         /** Tries to convert the value to an integer and write it to 'result'
713          */
714         bool ConfValueInteger(ConfigDataHash &target, const char* tag, const char* var, const char* default_value, int index, int &result);
715         /** Tries to convert the value to an integer and write it to 'result'
716          */
717         bool ConfValueInteger(ConfigDataHash &target, const std::string &tag, const std::string &var, int index, int &result);
718         /** Tries to convert the value to an integer and write it to 'result'
719          */
720         bool ConfValueInteger(ConfigDataHash &target, const std::string &tag, const std::string &var, const std::string &default_value, int index, int &result);
721         
722         /** Returns true if the value exists and has a true value, false otherwise
723          */
724         bool ConfValueBool(ConfigDataHash &target, const char* tag, const char* var, int index);
725         /** Returns true if the value exists and has a true value, false otherwise
726          */
727         bool ConfValueBool(ConfigDataHash &target, const char* tag, const char* var, const char* default_value, int index);
728         /** Returns true if the value exists and has a true value, false otherwise
729          */
730         bool ConfValueBool(ConfigDataHash &target, const std::string &tag, const std::string &var, int index);
731         /** Returns true if the value exists and has a true value, false otherwise
732          */
733         bool ConfValueBool(ConfigDataHash &target, const std::string &tag, const std::string &var, const std::string &default_value, int index);
734         
735         /** Returns the number of occurences of tag in the config file
736          */
737         int ConfValueEnum(ConfigDataHash &target, const char* tag);
738         /** Returns the number of occurences of tag in the config file
739          */
740         int ConfValueEnum(ConfigDataHash &target, const std::string &tag);
741         
742         /** Returns the numbers of vars inside the index'th 'tag in the config file
743          */
744         int ConfVarEnum(ConfigDataHash &target, const char* tag, int index);
745         /** Returns the numbers of vars inside the index'th 'tag in the config file
746          */
747         int ConfVarEnum(ConfigDataHash &target, const std::string &tag, int index);
748
749         void ValidateHostname(const char* p, const std::string &tag, const std::string &val);
750
751         void ValidateIP(const char* p, const std::string &tag, const std::string &val, bool wild);
752
753         void ValidateNoSpaces(const char* p, const std::string &tag, const std::string &val);
754         
755         /** Get a pointer to the module which has hooked the given port.
756          * @parameter port Port number
757          * @return Returns a pointer to the hooking module, or NULL
758          */
759         Module* GetIOHook(int port);
760
761         /** Hook a module to a client port, so that it can receive notifications
762          * of low-level port activity.
763          * @param port The port number
764          * @param Module the module to hook to the port
765          * @return True if the hook was successful.
766          */
767         bool AddIOHook(int port, Module* iomod);
768
769         /** Delete a module hook from a client port.
770          * @param port The port to detatch from
771          * @return True if successful
772          */
773         bool DelIOHook(int port);
774         
775         /** Get a pointer to the module which has hooked the given BufferedSocket class.
776          * @parameter port Port number
777          * @return Returns a pointer to the hooking module, or NULL
778          */
779         Module* GetIOHook(BufferedSocket* is);
780
781         /** Hook a module to an BufferedSocket class, so that it can receive notifications
782          * of low-level socket activity.
783          * @param iomod The module to hook to the socket
784          * @param is The BufferedSocket to attach to
785          * @return True if the hook was successful.
786          */
787         bool AddIOHook(Module* iomod, BufferedSocket* is);
788
789         /** Delete a module hook from an BufferedSocket.
790          * @param is The BufferedSocket to detatch from.
791          * @return True if the unhook was successful
792          */
793         bool DelIOHook(BufferedSocket* is);
794
795         /** Returns the fully qualified path to the inspircd directory
796          * @return The full program directory
797          */
798         std::string GetFullProgDir();
799
800         /** Returns true if a directory is valid (within the modules directory).
801          * @param dirandfile The directory and filename to check
802          * @return True if the directory is valid
803          */
804         static bool DirValid(const char* dirandfile);
805
806         /** Clean a filename, stripping the directories (and drives) from string.
807          * @param name Directory to tidy
808          * @return The cleaned filename
809          */
810         static char* CleanFilename(char* name);
811
812         /** Check if a file exists.
813          * @param file The full path to a file
814          * @return True if the file exists and is readable.
815          */
816         static bool FileExists(const char* file);
817         
818 };
819
820 /** Initialize the disabled commands list
821  */
822 CoreExport bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
823
824 /** Initialize the oper types
825  */
826 bool InitTypes(ServerConfig* conf, const char* tag);
827
828 /** Initialize the oper classes
829  */
830 bool InitClasses(ServerConfig* conf, const char* tag);
831
832 /** Initialize an oper type 
833  */
834 bool DoType(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
835
836 /** Initialize an oper class
837  */
838 bool DoClass(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
839
840 /** Finish initializing the oper types and classes
841  */
842 bool DoneClassesAndTypes(ServerConfig* conf, const char* tag);
843
844
845
846 /** Initialize x line
847  */
848 bool InitXLine(ServerConfig* conf, const char* tag);
849  
850 /** Add a config-defined zline
851  */
852 bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
853
854 /** Add a config-defined qline
855  */
856 bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
857
858 /** Add a config-defined kline
859  */
860 bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
861
862 /** Add a config-defined eline
863  */
864 bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
865
866
867
868
869 #endif
870