]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspircd.h
27c90cce8d83522ffd02083893928e7f74bed6f6
[user/henk/code/inspircd.git] / include / inspircd.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 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 #include <string>
18 #include <stdio.h>
19 #include <syslog.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <signal.h>
23 #include <time.h>
24 #include <netdb.h>
25 #include <string.h>
26 #include <ctype.h>
27 #include <errno.h>
28 #include <stdarg.h>
29 #include <assert.h>
30 #include <sys/param.h>
31 #include <sys/types.h>
32
33 #ifndef _LINUX_C_LIB_VERSION
34 #include <sys/socket.h>
35 #include <sys/stat.h>
36 #include <netinet/in.h>
37 #endif
38
39 #include <arpa/inet.h>
40 #include <string>
41 #include <deque>
42
43 #include "inspircd_config.h"
44 #include "inspircd_io.h"
45 #include "inspircd_util.h"
46 #include "users.h"
47 #include "channels.h"
48 #include "servers.h"
49
50 // some misc defines
51
52 #define ERROR -1
53 #define TRUE 1
54 #define FALSE 0
55 #define IDENTMAX 12
56 #define MAXSOCKS 64
57
58 // maximum lengths of items
59
60 #define MAXQUIT 255
61 #define MAXCOMMAND 32
62 #define MAXTOPIC 307
63 #define MAXKICK 255
64
65 // flags for use with log()
66
67 #define DEBUG 10
68 #define VERBOSE 20
69 #define DEFAULT 30
70 #define SPARSE 40
71 #define NONE 50
72
73 // flags for use with WriteMode
74
75 #define WM_AND 1
76 #define WM_OR 2
77
78 // flags for use with OnUserPreMessage and OnUserPreNotice
79
80 #define TYPE_USER 1
81 #define TYPE_CHANNEL 2
82
83 typedef std::deque<std::string> file_cache;
84
85 typedef void (handlerfunc) (char**, int, userrec*);
86
87 /* prototypes */
88 int InspIRCd(char** argv, int argc);
89 int InitConfig(void);
90 void ReadConfig(bool bail,userrec* user);
91
92 std::string getservername();
93 std::string getserverdesc();
94 std::string getnetworkname();
95 std::string getadminname();
96 std::string getadminemail();
97 std::string getadminnick();
98 void readfile(file_cache &F, const char* fname);
99 bool ModeDefined(char c, int i);
100 bool ModeDefinedOper(char c, int i);
101 int ModeDefinedOn(char c, int i);
102 int ModeDefinedOff(char c, int i);
103 void ModeMakeList(char modechar);
104 bool ModeIsListMode(char modechar, int type);
105 chanrec* add_channel(userrec *user, const char* cn, const char* key, bool override);
106 chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool local);
107 void force_nickchange(userrec* user,const char* newnick);
108 void kill_link(userrec *user,const char* r);
109 void kill_link_silent(userrec *user,const char* r);
110 void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user);
111 long GetRevision();
112 int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins);
113 void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason);
114 void AddWhoWas(userrec* u);
115 void update_stats_l(int fd,int data_out);
116 void ConnectUser(userrec *user);
117 void DoSplitEveryone();
118 userrec* ReHashNick(char* Old, char* New);
119 bool LoadModule(const char* filename);
120 bool UnloadModule(const char* filename);
121 char* ModuleError();
122 void NoticeAll(userrec *source, bool local_only, char* text, ...);
123 void NoticeAllOpers(userrec *source, bool local_only, char* text, ...);
124
125 void NetSendMyRoutingTable();
126 void DoSplit(const char* params);
127 void RemoveServer(const char* name);
128 void DoSync(serverrec* serv, char* tcp_host);
129
130 // optimization tricks to save us walking the user hash
131
132 void AddOper(userrec* user);
133 void DeleteOper(userrec* user);
134
135 void handle_version(char **parameters, int pcnt, userrec *user);