]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/helperfuncs.h
Move tons more stuff into class InspIRCd
[user/henk/code/inspircd.git] / include / helperfuncs.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #ifndef _HELPER_H_
18 #define _HELPER_H_
19
20 #include "dynamic.h"
21 #include "base.h"
22 #include "ctables.h"
23 #include "users.h"
24 #include "channels.h"
25 #include "typedefs.h"
26 #include <string>
27 #include <deque>
28 #include <sstream>
29
30 /** Debug levels for use with InspIRCd::Log()
31  */
32 enum DebugLevel
33 {
34         DEBUG = 10,
35         VERBOSE = 20,
36         DEFAULT = 30,
37         SPARSE = 40,
38         NONE = 50,
39 };
40
41 /* I'm not entirely happy with this, the ## before 'args' is a g++ extension.
42  * The problem is that if you #define log(l, x, args...) and then call it
43  * with only two parameters, you get do_log(l, x, ), which is a syntax error...
44  * The ## tells g++ to remove the trailing comma...
45  * If this is ever an issue, we can just have an #ifndef GCC then #define log(a...) do_log(a)
46  */
47 #define STRINGIFY2(x) #x
48 #define STRINGIFY(x) STRINGIFY2(x) 
49 #define log(l, x, args...) InspIRCd::Log(l, __FILE__ ":" STRINGIFY(__LINE__) ": " x, ##args)
50
51 void WriteOpers(const char* text, ...);
52 void WriteOpers_NoFormat(const char* text);
53
54 std::string GetServerDescription(const char* servername);
55 void strlower(char *n);
56 userrec* Find(const std::string &nick);
57 userrec* Find(const char* nick);
58 chanrec* FindChan(const char* chan);
59 int usercount_i(chanrec *c);
60 long GetMaxBans(char* name);
61 void purge_empty_chans(userrec* u);
62 char* chanmodes(chanrec *chan, bool showkey);
63 void userlist(userrec *user,chanrec *c);
64 ConnectClass GetClass(userrec *user);
65 void Error(int status);
66 void ShowMOTD(userrec *user);
67 void ShowRULES(userrec *user);
68 bool AllModulesReportReady(userrec* user);
69 bool DirValid(char* dirandfile);
70 bool FileExists(const char* file);
71 char* CleanFilename(char* name);
72 std::string GetFullProgDir(char** argv, int argc);
73 int InsertMode(std::string &output, const char* modes, unsigned short section);
74 bool IsValidChannelName(const char *);
75
76 int charlcat(char* x,char y,int z);
77 bool charremove(char* mp, char remove);
78
79 #endif