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