12 #include "inspircd_io.h"
14 // version is a simple class for holding a modules version number
16 Version::Version(int major, int minor, int revision, int build) : Major(major), Minor(minor), Revision(revision), Build(build) { };
18 // admin is a simple class for holding a server's administrative info
20 Admin::Admin(string name, string email, string nick) : Name(name), Email(email), Nick(nick) { };
23 // Announce to the world that the Module base
24 // class has been created or destroyed
29 void Module::OnUserConnect(userrec* user) { }
30 void Module::OnUserQuit(userrec* user) { }
31 void Module::OnUserJoin(userrec* user, chanrec* channel) { }
32 void Module::OnUserPart(userrec* user, chanrec* channel) { }
33 void Module::OnPacketTransmit(char *p) { }
34 void Module::OnPacketReceive(char *p) { }
35 void Module::OnRehash() { }
36 void Module::OnServerRaw(string &raw, bool inbound) { }
37 bool Module::OnExtendedMode(char modechar, int type, bool mode_on, string_list ¶ms) { }
38 Version Module::GetVersion() { return Version(1,0,0,0); }
40 // server is a wrapper class that provides methods to all of the C-style
41 // exports in the core
52 void Server::SendOpers(string s)
54 WriteOpers("%s",s.c_str());
57 void Server::Log(int level, string s)
59 log(level,"%s",s.c_str());
62 void Server::Send(int Socket, string s)
64 Write(Socket,"%s",s.c_str());
67 void Server::SendServ(int Socket, string s)
69 WriteServ(Socket,"%s",s.c_str());
72 void Server::SendFrom(int Socket, userrec* User, string s)
74 WriteFrom(Socket,User,"%s",s.c_str());
77 void Server::SendTo(userrec* Source, userrec* Dest, string s)
79 WriteTo(Source,Dest,"%s",s.c_str());
82 void Server::SendChannel(userrec* User, chanrec* Channel, string s,bool IncludeSender)
86 WriteChannel(Channel,User,"%s",s.c_str());
90 ChanExceptSender(Channel,User,"%s",s.c_str());
94 bool Server::CommonChannels(userrec* u1, userrec* u2)
96 return (common_channels(u1,u2) != 0);
99 void Server::SendCommon(userrec* User, string text,bool IncludeSender)
103 WriteCommon(User,"%s",text.c_str());
107 WriteCommonExcept(User,"%s",text.c_str());
111 void Server::SendWallops(userrec* User, string text)
113 WriteWallOps(User,"%s",text.c_str());
116 bool Server::IsNick(string nick)
118 return (isnick(nick.c_str()) != 0);
121 userrec* Server::FindNick(string nick)
126 chanrec* Server::FindChannel(string channel)
128 return FindChan(channel.c_str());
131 string Server::ChanMode(userrec* User, chanrec* Chan)
133 string mode = cmode(User,Chan);
137 string Server::GetServerName()
139 return getservername();
142 string Server::GetNetworkName()
144 return getnetworkname();
147 Admin Server::GetAdmin()
149 return Admin(getadminname(),getadminemail(),getadminnick());
153 ConfigReader::ConfigReader()
159 ConfigReader::~ConfigReader()
164 bool Server::AddExtendedMode(char modechar, int type, bool default_on, int params_when_on, int params_when_off)
169 ConfigReader::ConfigReader(string filename) : fname(filename) { };
171 string ConfigReader::ReadValue(string tag, string name, int index)
174 ReadConf(fname.c_str(),tag.c_str(),name.c_str(),index,val);
180 int ConfigReader::Enumerate(string tag)
182 return EnumConf(fname.c_str(),tag.c_str());
186 bool ConfigReader::Verify()
192 FileReader::FileReader(string filename)
195 readfile(c,filename.c_str());
199 FileReader::FileReader()
203 void FileReader::LoadFile(string filename)
206 readfile(c,filename.c_str());
210 FileReader::~FileReader()
214 string FileReader::GetLine(int x)
216 if ((x<0) || (x>fc.size()))
221 int FileReader::FileSize()
227 vector<Module*> modules(255);
228 vector<ircd_module*> factory(255);