1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "inspircd_config.h"
26 #include <sys/types.h>
28 #ifndef _LINUX_C_LIB_VERSION
29 #include <sys/socket.h>
31 #include <netinet/in.h>
34 #include <arpa/inet.h>
38 #include "inspircd_io.h"
39 #include "inspircd_util.h"
51 // flags for use with log()
59 // flags for use with WriteMode
64 // flags for use with OnUserPreMessage and OnUserPreNotice
67 #define TYPE_CHANNEL 2
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)
74 typedef std::deque<std::string> file_cache;
91 statsAccept = statsRefused = statsUnknown = 0;
92 statsCollisions = statsDns = statsDnsGood = 0;
93 statsDnsBad = statsConnects = statsSent = statsRecv = 0;
97 typedef void (handlerfunc) (char**, int, userrec*);
100 int InspIRCd(char** argv, int argc);
101 int InitConfig(void);
102 void ReadConfig(bool bail,userrec* user);
104 std::string getservername();
105 std::string getserverdesc();
106 std::string getnetworkname();
107 std::string getadminname();
108 std::string getadminemail();
109 std::string getadminnick();
110 void readfile(file_cache &F, const char* fname);
111 bool ModeDefined(char c, int i);
112 bool ModeDefinedOper(char c, int i);
113 int ModeDefinedOn(char c, int i);
114 int ModeDefinedOff(char c, int i);
115 void ModeMakeList(char modechar);
116 bool ModeIsListMode(char modechar, int type);
117 chanrec* add_channel(userrec *user, const char* cn, const char* key, bool override);
118 chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool local);
119 void force_nickchange(userrec* user,const char* newnick);
120 void kill_link(userrec *user,const char* r);
121 void kill_link_silent(userrec *user,const char* r);
122 void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user);
123 bool is_valid_cmd(const char* commandname, int pcnt, userrec * user);
124 std::string GetRevision();
125 int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins);
126 void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason);
127 void AddWhoWas(userrec* u);
128 void update_stats_l(int fd,int data_out);
129 void ConnectUser(userrec *user);
130 void DoSplitEveryone();
131 userrec* ReHashNick(char* Old, char* New);
132 bool LoadModule(const char* filename);
133 bool UnloadModule(const char* filename);
135 void NoticeAll(userrec *source, bool local_only, char* text, ...);
136 void ServerNoticeAll(char* text, ...);
137 void ServerPrivmsgAll(char* text, ...);
138 void NoticeAllOpers(userrec *source, bool local_only, char* text, ...);
140 // optimization tricks to save us walking the user hash
142 void AddOper(userrec* user);
143 void DeleteOper(userrec* user);
145 void handle_version(char **parameters, int pcnt, userrec *user);
147 // userrec optimization stuff
149 void AddServerName(std::string servername);
150 const char* FindServerNamePtr(std::string servername);
152 std::string GetVersionString();
154 void* dns_task(void* arg);
156 void process_buffer(const char* cmdbuf,userrec *user);
157 void FullConnectUser(userrec* user);
158 chanrec* ForceChan(chanrec* Ptr,ucrec &a,userrec* user, int created);