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 * ---------------------------------------------------
30 #include <sys/param.h>
31 #include <sys/types.h>
33 #ifndef _LINUX_C_LIB_VERSION
34 #include <sys/socket.h>
36 #include <netinet/in.h>
39 #include <arpa/inet.h>
43 #include "inspircd_config.h"
44 #include "inspircd_io.h"
45 #include "inspircd_util.h"
58 // maximum lengths of items
65 // flags for use with log()
73 // flags for use with WriteMode
78 // flags for use with OnUserPreMessage and OnUserPreNotice
81 #define TYPE_CHANNEL 2
83 typedef std::deque<std::string> file_cache;
85 typedef void (handlerfunc) (char**, int, userrec*);
90 void Error(int status);
91 void send_error(char *s);
92 void ReadConfig(bool bail,userrec* user);
93 void strlower(char *n);
95 void WriteOpers(char* text, ...);
96 void WriteMode(const char* modes, int flags, const char* text, ...);
97 void log(int level, char *text, ...);
98 void Write(int sock,char *text, ...);
99 void WriteServ(int sock, char* text, ...);
100 void WriteFrom(int sock, userrec *user,char* text, ...);
101 void WriteTo(userrec *source, userrec *dest,char *data, ...);
102 void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...);
103 void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...);
104 void WriteCommon(userrec *u, char* text, ...);
105 void WriteCommonExcept(userrec *u, char* text, ...);
106 void WriteWallOps(userrec *source, bool local_only, char* text, ...);
107 void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...);
108 void WriteChannelWithServ(char* ServerName, chanrec* Ptr, userrec* user, char* text, ...);
109 char* chanmodes(chanrec *chan);
110 userrec* Find(std::string nick);
111 chanrec* FindChan(const char* chan);
112 std::string getservername();
113 std::string getserverdesc();
114 std::string getnetworkname();
115 std::string getadminname();
116 std::string getadminemail();
117 std::string getadminnick();
118 void readfile(file_cache &F, const char* fname);
119 bool ModeDefined(char c, int i);
120 bool ModeDefinedOper(char c, int i);
121 int ModeDefinedOn(char c, int i);
122 int ModeDefinedOff(char c, int i);
123 void ModeMakeList(char modechar);
124 bool ModeIsListMode(char modechar, int type);
125 chanrec* add_channel(userrec *user, const char* cn, const char* key, bool override);
126 chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool local);
127 void force_nickchange(userrec* user,const char* newnick);
128 void kill_link(userrec *user,const char* r);
129 void kill_link_silent(userrec *user,const char* r);
130 int usercount(chanrec *c);
131 void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user);
133 int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins);
134 void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason);
135 void purge_empty_chans(void);
136 char* Passwd(userrec *user);
137 bool IsDenied(userrec *user);
138 void AddWhoWas(userrec* u);
139 void userlist(userrec *user,chanrec *c);
140 std::string GetServerDescription(char* servername);
142 int registered_usercount(void);
143 int usercount_invisible(void);
144 int usercount_opers(void);
145 int usercount_unknown(void);
146 long chancount(void);
147 long count_servs(void);
148 long servercount(void);
150 void ShowMOTD(userrec *user);
151 void ShowRULES(userrec *user);
152 int usercount(chanrec *c);
153 int usercount_i(chanrec *c);
154 void update_stats_l(int fd,int data_out);
155 void ConnectUser(userrec *user);
156 void DoSplitEveryone();
157 char islast(const char* s);
158 long map_count(const char* s);
159 userrec* ReHashNick(char* Old, char* New);
160 long GetMaxBans(char* name);
161 bool LoadModule(const char* filename);
162 bool UnloadModule(const char* filename);
165 // mesh network functions
167 void NetSendToCommon(userrec* u, char* s);
168 void NetSendToAll(char* s);
169 void NetSendToAllAlive(char* s);
170 void NetSendToOne(char* target,char* s);
171 void NetSendToAllExcept(const char* target,char* s);
172 void NetSendMyRoutingTable();
173 void DoSplit(const char* params);
174 void RemoveServer(const char* name);
175 void DoSync(serverrec* serv, char* tcp_host);