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;
76 typedef void (handlerfunc) (char**, int, userrec*);
79 int InspIRCd(char** argv, int argc);
81 void ReadConfig(bool bail,userrec* user);
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);
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, ...);
119 // optimization tricks to save us walking the user hash
121 void AddOper(userrec* user);
122 void DeleteOper(userrec* user);
124 void handle_version(char **parameters, int pcnt, userrec *user);
126 // userrec optimization stuff
128 void AddServerName(std::string servername);
129 const char* FindServerNamePtr(std::string servername);
131 std::string GetVersionString();
133 void* dns_task(void* arg);
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);