From b25c31de6b8dd839429cb168f5731a5605e17366 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 24 Apr 2004 23:26:47 +0000 Subject: Added new documentation for XLine etc git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@718 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/modules_8cpp-source.html | 801 ++++++++++++++++--------------- 1 file changed, 406 insertions(+), 395 deletions(-) (limited to 'docs/module-doc/modules_8cpp-source.html') diff --git a/docs/module-doc/modules_8cpp-source.html b/docs/module-doc/modules_8cpp-source.html index 2330e194c..be1a97cfd 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -20,426 +20,437 @@ 00012 #include "ctables.h" 00013 #include "inspircd_io.h" 00014 #include "wildcard.h" -00015 #include "mode.h" -00016 #include "message.h" -00017 -00018 // class type for holding an extended mode character - internal to core -00019 -00020 class ExtMode : public classbase -00021 { -00022 public: -00023 char modechar; -00024 int type; -00025 int params_when_on; -00026 int params_when_off; -00027 bool needsoper; -00028 ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { }; -00029 }; -00030 -00031 typedef std::vector<ExtMode> ExtModeList; -00032 typedef ExtModeList::iterator ExtModeListIter; -00033 -00034 ExtModeList EMode; -00035 -00036 // returns true if an extended mode character is in use -00037 bool ModeDefined(char modechar, int type) -00038 { -00039 log(DEBUG,"Size of extmodes vector is %d",EMode.size()); -00040 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) -00041 { -00042 log(DEBUG,"i->modechar==%c, modechar=%c, i->type=%d, type=%d",i->modechar,modechar,i->type,type); -00043 if ((i->modechar == modechar) && (i->type == type)) -00044 { -00045 return true; -00046 } -00047 } -00048 return false; -00049 } -00050 -00051 bool ModeDefinedOper(char modechar, int type) -00052 { -00053 log(DEBUG,"Size of extmodes vector is %d",EMode.size()); -00054 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) -00055 { -00056 log(DEBUG,"i->modechar==%c, modechar=%c, i->type=%d, type=%d",i->modechar,modechar,i->type,type); -00057 if ((i->modechar == modechar) && (i->type == type) && (i->needsoper == true)) -00058 { -00059 return true; -00060 } -00061 } -00062 return false; -00063 } -00064 -00065 // returns number of parameters for a custom mode when it is switched on -00066 int ModeDefinedOn(char modechar, int type) -00067 { -00068 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) -00069 { -00070 if ((i->modechar == modechar) && (i->type == type)) -00071 { -00072 return i->params_when_on; -00073 } -00074 } -00075 return 0; -00076 } -00077 -00078 // returns number of parameters for a custom mode when it is switched on -00079 int ModeDefinedOff(char modechar, int type) -00080 { -00081 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) -00082 { -00083 if ((i->modechar == modechar) && (i->type == type)) -00084 { -00085 return i->params_when_off; -00086 } -00087 } -00088 return 0; -00089 } -00090 -00091 // returns true if an extended mode character is in use -00092 bool DoAddExtendedMode(char modechar, int type, bool requires_oper, int params_on, int params_off) -00093 { -00094 if (ModeDefined(modechar,type)) { -00095 return false; -00096 } -00097 EMode.push_back(ExtMode(modechar,type,requires_oper,params_on,params_off)); -00098 return true; -00099 } -00100 +00015 #include "mode.h" +00016 #include "message.h" +00017 #include "commands.h" +00018 +00019 // class type for holding an extended mode character - internal to core +00020 +00021 class ExtMode : public classbase +00022 { +00023 public: +00024 char modechar; +00025 int type; +00026 int params_when_on; +00027 int params_when_off; +00028 bool needsoper; +00029 ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { }; +00030 }; +00031 +00032 typedef std::vector<ExtMode> ExtModeList; +00033 typedef ExtModeList::iterator ExtModeListIter; +00034 +00035 ExtModeList EMode; +00036 +00037 // returns true if an extended mode character is in use +00038 bool ModeDefined(char modechar, int type) +00039 { +00040 log(DEBUG,"Size of extmodes vector is %d",EMode.size()); +00041 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) +00042 { +00043 log(DEBUG,"i->modechar==%c, modechar=%c, i->type=%d, type=%d",i->modechar,modechar,i->type,type); +00044 if ((i->modechar == modechar) && (i->type == type)) +00045 { +00046 return true; +00047 } +00048 } +00049 return false; +00050 } +00051 +00052 bool ModeDefinedOper(char modechar, int type) +00053 { +00054 log(DEBUG,"Size of extmodes vector is %d",EMode.size()); +00055 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) +00056 { +00057 log(DEBUG,"i->modechar==%c, modechar=%c, i->type=%d, type=%d",i->modechar,modechar,i->type,type); +00058 if ((i->modechar == modechar) && (i->type == type) && (i->needsoper == true)) +00059 { +00060 return true; +00061 } +00062 } +00063 return false; +00064 } +00065 +00066 // returns number of parameters for a custom mode when it is switched on +00067 int ModeDefinedOn(char modechar, int type) +00068 { +00069 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) +00070 { +00071 if ((i->modechar == modechar) && (i->type == type)) +00072 { +00073 return i->params_when_on; +00074 } +00075 } +00076 return 0; +00077 } +00078 +00079 // returns number of parameters for a custom mode when it is switched on +00080 int ModeDefinedOff(char modechar, int type) +00081 { +00082 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++) +00083 { +00084 if ((i->modechar == modechar) && (i->type == type)) +00085 { +00086 return i->params_when_off; +00087 } +00088 } +00089 return 0; +00090 } +00091 +00092 // returns true if an extended mode character is in use +00093 bool DoAddExtendedMode(char modechar, int type, bool requires_oper, int params_on, int params_off) +00094 { +00095 if (ModeDefined(modechar,type)) { +00096 return false; +00097 } +00098 EMode.push_back(ExtMode(modechar,type,requires_oper,params_on,params_off)); +00099 return true; +00100 } 00101 -00102 // version is a simple class for holding a modules version number -00103 -00104 Version::Version(int major, int minor, int revision, int build) : Major(major), Minor(minor), Revision(revision), Build(build) { }; -00105 -00106 // admin is a simple class for holding a server's administrative info -00107 -00108 Admin::Admin(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { }; -00109 -00110 Module::Module() { } -00111 Module::~Module() { } -00112 void Module::OnUserConnect(userrec* user) { } -00113 void Module::OnUserQuit(userrec* user) { } -00114 void Module::OnUserJoin(userrec* user, chanrec* channel) { } -00115 void Module::OnUserPart(userrec* user, chanrec* channel) { } -00116 void Module::OnPacketTransmit(char *p) { } -00117 void Module::OnPacketReceive(char *p) { } -00118 void Module::OnRehash() { } -00119 void Module::OnServerRaw(std::string &raw, bool inbound) { } -00120 int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; } -00121 bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params) { return false; } -00122 Version Module::GetVersion() { return Version(1,0,0,0); } -00123 void Module::OnOper(userrec* user) { }; -00124 void Module::OnInfo(userrec* user) { }; -00125 void Module::OnWhois(userrec* source, userrec* dest) { }; -00126 int Module::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text) { return 0; }; -00127 int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text) { return 0; }; -00128 -00129 // server is a wrapper class that provides methods to all of the C-style -00130 // exports in the core -00131 // -00132 -00133 Server::Server() -00134 { -00135 } -00136 -00137 Server::~Server() -00138 { -00139 } -00140 -00141 void Server::SendOpers(std::string s) -00142 { -00143 WriteOpers("%s",s.c_str()); -00144 } -00145 -00146 bool Server::MatchText(std::string sliteral, std::string spattern) -00147 { -00148 char literal[MAXBUF],pattern[MAXBUF]; -00149 strncpy(literal,sliteral.c_str(),MAXBUF); -00150 strncpy(pattern,spattern.c_str(),MAXBUF); -00151 return match(literal,pattern); -00152 } -00153 -00154 void Server::SendToModeMask(std::string modes, int flags, std::string text) -00155 { -00156 WriteMode(modes.c_str(),flags,"%s",text.c_str()); -00157 } -00158 -00159 chanrec* Server::JoinUserToChannel(userrec* user, std::string cname, std::string key) -00160 { -00161 return add_channel(user,cname.c_str(),key.c_str(),true); -00162 } -00163 -00164 chanrec* Server::PartUserFromChannel(userrec* user, std::string cname, std::string reason) -00165 { -00166 return del_channel(user,cname.c_str(),reason.c_str(),false); -00167 } -00168 -00169 void Server::ChangeUserNick(userrec* user, std::string nickname) -00170 { -00171 force_nickchange(user,nickname.c_str()); -00172 } -00173 -00174 void Server::QuitUser(userrec* user, std::string reason) -00175 { -00176 send_network_quit(user->nick,reason.c_str()); -00177 kill_link(user,reason.c_str()); -00178 } -00179 -00180 void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user) -00181 { -00182 call_handler(commandname.c_str(),parameters,pcnt,user); -00183 } -00184 -00185 void Server::Log(int level, std::string s) -00186 { -00187 log(level,"%s",s.c_str()); -00188 } -00189 -00190 void Server::AddCommand(char* cmd, handlerfunc f, char flags, int minparams) -00191 { -00192 createcommand(cmd,f,flags,minparams); -00193 } -00194 -00195 void Server::SendMode(char **parameters, int pcnt, userrec *user) -00196 { -00197 server_mode(parameters,pcnt,user); -00198 } -00199 -00200 void Server::Send(int Socket, std::string s) -00201 { -00202 Write(Socket,"%s",s.c_str()); -00203 } -00204 -00205 void Server::SendServ(int Socket, std::string s) -00206 { -00207 WriteServ(Socket,"%s",s.c_str()); -00208 } -00209 -00210 void Server::SendFrom(int Socket, userrec* User, std::string s) -00211 { -00212 WriteFrom(Socket,User,"%s",s.c_str()); -00213 } -00214 -00215 void Server::SendTo(userrec* Source, userrec* Dest, std::string s) -00216 { -00217 if (!Source) -00218 { -00219 // if source is NULL, then the message originates from the local server -00220 Write(Dest->fd,":%s %s",this->GetServerName().c_str(),s.c_str()); -00221 } -00222 else -00223 { -00224 // otherwise it comes from the user specified -00225 WriteTo(Source,Dest,"%s",s.c_str()); -00226 } -00227 } -00228 -00229 void Server::SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender) -00230 { -00231 if (IncludeSender) -00232 { -00233 WriteChannel(Channel,User,"%s",s.c_str()); -00234 } -00235 else -00236 { -00237 ChanExceptSender(Channel,User,"%s",s.c_str()); -00238 } -00239 } -00240 -00241 bool Server::CommonChannels(userrec* u1, userrec* u2) -00242 { -00243 return (common_channels(u1,u2) != 0); -00244 } -00245 -00246 void Server::SendCommon(userrec* User, std::string text,bool IncludeSender) -00247 { -00248 if (IncludeSender) -00249 { -00250 WriteCommon(User,"%s",text.c_str()); -00251 } -00252 else -00253 { -00254 WriteCommonExcept(User,"%s",text.c_str()); -00255 } -00256 } -00257 -00258 void Server::SendWallops(userrec* User, std::string text) -00259 { -00260 WriteWallOps(User,false,"%s",text.c_str()); -00261 } -00262 -00263 void Server::ChangeHost(userrec* user, std::string host) -00264 { -00265 ChangeDisplayedHost(user,host.c_str()); -00266 } -00267 -00268 void Server::ChangeGECOS(userrec* user, std::string gecos) -00269 { -00270 ChangeName(user,gecos.c_str()); -00271 } -00272 -00273 bool Server::IsNick(std::string nick) -00274 { -00275 return (isnick(nick.c_str()) != 0); -00276 } -00277 -00278 userrec* Server::FindNick(std::string nick) -00279 { -00280 return Find(nick); -00281 } -00282 -00283 chanrec* Server::FindChannel(std::string channel) -00284 { -00285 return FindChan(channel.c_str()); -00286 } -00287 -00288 std::string Server::ChanMode(userrec* User, chanrec* Chan) -00289 { -00290 return cmode(User,Chan); -00291 } -00292 -00293 std::string Server::GetServerName() -00294 { -00295 return getservername(); -00296 } -00297 -00298 std::string Server::GetNetworkName() -00299 { -00300 return getnetworkname(); -00301 } -00302 -00303 Admin Server::GetAdmin() -00304 { -00305 return Admin(getadminname(),getadminemail(),getadminnick()); -00306 } -00307 -00308 +00102 +00103 // version is a simple class for holding a modules version number +00104 +00105 Version::Version(int major, int minor, int revision, int build) : Major(major), Minor(minor), Revision(revision), Build(build) { }; +00106 +00107 // admin is a simple class for holding a server's administrative info +00108 +00109 Admin::Admin(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { }; +00110 +00111 Module::Module() { } +00112 Module::~Module() { } +00113 void Module::OnUserConnect(userrec* user) { } +00114 void Module::OnUserQuit(userrec* user) { } +00115 void Module::OnUserJoin(userrec* user, chanrec* channel) { } +00116 void Module::OnUserPart(userrec* user, chanrec* channel) { } +00117 void Module::OnPacketTransmit(char *p) { } +00118 void Module::OnPacketReceive(char *p) { } +00119 void Module::OnRehash() { } +00120 void Module::OnServerRaw(std::string &raw, bool inbound) { } +00121 int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; } +00122 bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params) { return false; } +00123 Version Module::GetVersion() { return Version(1,0,0,0); } +00124 void Module::OnOper(userrec* user) { }; +00125 void Module::OnInfo(userrec* user) { }; +00126 void Module::OnWhois(userrec* source, userrec* dest) { }; +00127 int Module::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text) { return 0; }; +00128 int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text) { return 0; }; +00129 int Module::OnUserPreNick(userrec* user, std::string newnick) { return 0; }; +00130 +00131 // server is a wrapper class that provides methods to all of the C-style +00132 // exports in the core +00133 // +00134 +00135 Server::Server() +00136 { +00137 } +00138 +00139 Server::~Server() +00140 { +00141 } +00142 +00143 void Server::SendOpers(std::string s) +00144 { +00145 WriteOpers("%s",s.c_str()); +00146 } +00147 +00148 bool Server::MatchText(std::string sliteral, std::string spattern) +00149 { +00150 char literal[MAXBUF],pattern[MAXBUF]; +00151 strncpy(literal,sliteral.c_str(),MAXBUF); +00152 strncpy(pattern,spattern.c_str(),MAXBUF); +00153 return match(literal,pattern); +00154 } +00155 +00156 void Server::SendToModeMask(std::string modes, int flags, std::string text) +00157 { +00158 WriteMode(modes.c_str(),flags,"%s",text.c_str()); +00159 } +00160 +00161 chanrec* Server::JoinUserToChannel(userrec* user, std::string cname, std::string key) +00162 { +00163 return add_channel(user,cname.c_str(),key.c_str(),true); +00164 } +00165 +00166 chanrec* Server::PartUserFromChannel(userrec* user, std::string cname, std::string reason) +00167 { +00168 return del_channel(user,cname.c_str(),reason.c_str(),false); +00169 } +00170 +00171 void Server::ChangeUserNick(userrec* user, std::string nickname) +00172 { +00173 force_nickchange(user,nickname.c_str()); +00174 } +00175 +00176 void Server::QuitUser(userrec* user, std::string reason) +00177 { +00178 send_network_quit(user->nick,reason.c_str()); +00179 kill_link(user,reason.c_str()); +00180 } +00181 +00182 bool Server::IsUlined(std::string server) +00183 { +00184 return is_uline(server.c_str()); +00185 } +00186 +00187 void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user) +00188 { +00189 call_handler(commandname.c_str(),parameters,pcnt,user); +00190 } +00191 +00192 void Server::Log(int level, std::string s) +00193 { +00194 log(level,"%s",s.c_str()); +00195 } +00196 +00197 void Server::AddCommand(char* cmd, handlerfunc f, char flags, int minparams) +00198 { +00199 createcommand(cmd,f,flags,minparams); +00200 } +00201 +00202 void Server::SendMode(char **parameters, int pcnt, userrec *user) +00203 { +00204 server_mode(parameters,pcnt,user); +00205 } +00206 +00207 void Server::Send(int Socket, std::string s) +00208 { +00209 Write(Socket,"%s",s.c_str()); +00210 } +00211 +00212 void Server::SendServ(int Socket, std::string s) +00213 { +00214 WriteServ(Socket,"%s",s.c_str()); +00215 } +00216 +00217 void Server::SendFrom(int Socket, userrec* User, std::string s) +00218 { +00219 WriteFrom(Socket,User,"%s",s.c_str()); +00220 } +00221 +00222 void Server::SendTo(userrec* Source, userrec* Dest, std::string s) +00223 { +00224 if (!Source) +00225 { +00226 // if source is NULL, then the message originates from the local server +00227 Write(Dest->fd,":%s %s",this->GetServerName().c_str(),s.c_str()); +00228 } +00229 else +00230 { +00231 // otherwise it comes from the user specified +00232 WriteTo(Source,Dest,"%s",s.c_str()); +00233 } +00234 } +00235 +00236 void Server::SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender) +00237 { +00238 if (IncludeSender) +00239 { +00240 WriteChannel(Channel,User,"%s",s.c_str()); +00241 } +00242 else +00243 { +00244 ChanExceptSender(Channel,User,"%s",s.c_str()); +00245 } +00246 } +00247 +00248 bool Server::CommonChannels(userrec* u1, userrec* u2) +00249 { +00250 return (common_channels(u1,u2) != 0); +00251 } +00252 +00253 void Server::SendCommon(userrec* User, std::string text,bool IncludeSender) +00254 { +00255 if (IncludeSender) +00256 { +00257 WriteCommon(User,"%s",text.c_str()); +00258 } +00259 else +00260 { +00261 WriteCommonExcept(User,"%s",text.c_str()); +00262 } +00263 } +00264 +00265 void Server::SendWallops(userrec* User, std::string text) +00266 { +00267 WriteWallOps(User,false,"%s",text.c_str()); +00268 } +00269 +00270 void Server::ChangeHost(userrec* user, std::string host) +00271 { +00272 ChangeDisplayedHost(user,host.c_str()); +00273 } +00274 +00275 void Server::ChangeGECOS(userrec* user, std::string gecos) +00276 { +00277 ChangeName(user,gecos.c_str()); +00278 } +00279 +00280 bool Server::IsNick(std::string nick) +00281 { +00282 return (isnick(nick.c_str()) != 0); +00283 } +00284 +00285 userrec* Server::FindNick(std::string nick) +00286 { +00287 return Find(nick); +00288 } +00289 +00290 chanrec* Server::FindChannel(std::string channel) +00291 { +00292 return FindChan(channel.c_str()); +00293 } +00294 +00295 std::string Server::ChanMode(userrec* User, chanrec* Chan) +00296 { +00297 return cmode(User,Chan); +00298 } +00299 +00300 std::string Server::GetServerName() +00301 { +00302 return getservername(); +00303 } +00304 +00305 std::string Server::GetNetworkName() +00306 { +00307 return getnetworkname(); +00308 } 00309 -00310 bool Server::AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off) +00310 Admin Server::GetAdmin() 00311 { -00312 if (type == MT_SERVER) -00313 { -00314 log(DEBUG,"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"); -00315 return false; -00316 } -00317 if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT)) -00318 { -00319 log(DEBUG,"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"); -00320 return false; -00321 } -00322 if ((params_when_on>1) || (params_when_off>1)) -00323 { -00324 log(DEBUG,"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"); -00325 return false; -00326 } -00327 return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off); -00328 } -00329 -00330 int Server::CountUsers(chanrec* c) -00331 { -00332 return usercount(c); -00333 } -00334 -00335 -00336 ConfigReader::ConfigReader() -00337 { -00338 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -00339 this->error = LoadConf(CONFIG_FILE,this->cache); +00312 return Admin(getadminname(),getadminemail(),getadminnick()); +00313 } +00314 +00315 +00316 +00317 bool Server::AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off) +00318 { +00319 if (type == MT_SERVER) +00320 { +00321 log(DEBUG,"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"); +00322 return false; +00323 } +00324 if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT)) +00325 { +00326 log(DEBUG,"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"); +00327 return false; +00328 } +00329 if ((params_when_on>1) || (params_when_off>1)) +00330 { +00331 log(DEBUG,"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"); +00332 return false; +00333 } +00334 return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off); +00335 } +00336 +00337 int Server::CountUsers(chanrec* c) +00338 { +00339 return usercount(c); 00340 } 00341 00342 -00343 ConfigReader::~ConfigReader() +00343 ConfigReader::ConfigReader() 00344 { -00345 if (this->cache) -00346 delete this->cache; +00345 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +00346 this->error = LoadConf(CONFIG_FILE,this->cache); 00347 } 00348 00349 -00350 ConfigReader::ConfigReader(std::string filename) +00350 ConfigReader::~ConfigReader() 00351 { -00352 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -00353 this->error = LoadConf(filename.c_str(),this->cache); -00354 }; +00352 if (this->cache) +00353 delete this->cache; +00354 } 00355 -00356 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) -00357 { -00358 char val[MAXBUF]; -00359 ReadConf(cache,tag.c_str(),name.c_str(),index,val); -00360 return val; -00361 } +00356 +00357 ConfigReader::ConfigReader(std::string filename) +00358 { +00359 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +00360 this->error = LoadConf(filename.c_str(),this->cache); +00361 }; 00362 -00363 -00364 int ConfigReader::Enumerate(std::string tag) -00365 { -00366 return EnumConf(cache,tag.c_str()); -00367 } -00368 -00369 int ConfigReader::EnumerateValues(std::string tag, int index) -00370 { -00371 return EnumValues(cache, tag.c_str(), index); +00363 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) +00364 { +00365 char val[MAXBUF]; +00366 char t[MAXBUF]; +00367 char n[MAXBUF]; +00368 strncpy(t,tag.c_str(),MAXBUF); +00369 strncpy(n,name.c_str(),MAXBUF); +00370 ReadConf(cache,t,n,index,val); +00371 return std::string(val); 00372 } 00373 -00374 bool ConfigReader::Verify() -00375 { -00376 return this->error; -00377 } -00378 +00374 +00375 int ConfigReader::Enumerate(std::string tag) +00376 { +00377 return EnumConf(cache,tag.c_str()); +00378 } 00379 -00380 FileReader::FileReader(std::string filename) +00380 int ConfigReader::EnumerateValues(std::string tag, int index) 00381 { -00382 file_cache c; -00383 readfile(c,filename.c_str()); -00384 this->fc = c; -00385 } -00386 -00387 FileReader::FileReader() -00388 { -00389 } +00382 return EnumValues(cache, tag.c_str(), index); +00383 } +00384 +00385 bool ConfigReader::Verify() +00386 { +00387 return this->error; +00388 } +00389 00390 -00391 void FileReader::LoadFile(std::string filename) +00391 FileReader::FileReader(std::string filename) 00392 { 00393 file_cache c; 00394 readfile(c,filename.c_str()); 00395 this->fc = c; 00396 } 00397 -00398 -00399 FileReader::~FileReader() -00400 { -00401 } -00402 -00403 bool FileReader::Exists() -00404 { -00405 if (fc.size() == 0) -00406 { -00407 return(false); -00408 } -00409 else -00410 { -00411 return(true); -00412 } -00413 } -00414 -00415 std::string FileReader::GetLine(int x) -00416 { -00417 if ((x<0) || (x>fc.size())) -00418 return ""; -00419 return fc[x]; -00420 } -00421 -00422 int FileReader::FileSize() -00423 { -00424 return fc.size(); -00425 } -00426 -00427 -00428 std::vector<Module*> modules(255); -00429 std::vector<ircd_module*> factory(255); -00430 -00431 int MODCOUNT = -1; +00398 FileReader::FileReader() +00399 { +00400 } +00401 +00402 void FileReader::LoadFile(std::string filename) +00403 { +00404 file_cache c; +00405 readfile(c,filename.c_str()); +00406 this->fc = c; +00407 } +00408 +00409 +00410 FileReader::~FileReader() +00411 { +00412 } +00413 +00414 bool FileReader::Exists() +00415 { +00416 if (fc.size() == 0) +00417 { +00418 return(false); +00419 } +00420 else +00421 { +00422 return(true); +00423 } +00424 } +00425 +00426 std::string FileReader::GetLine(int x) +00427 { +00428 if ((x<0) || (x>fc.size())) +00429 return ""; +00430 return fc[x]; +00431 } 00432 -00433 -
Generated on Mon Apr 19 02:34:32 2004 for InspIRCd by +00433 int FileReader::FileSize() +00434 { +00435 return fc.size(); +00436 } +00437 +00438 +00439 std::vector<Module*> modules(255); +00440 std::vector<ircd_module*> factory(255); +00441 +00442 int MODCOUNT = -1; +00443 +00444 +
Generated on Sun Apr 25 00:24:05 2004 for InspIRCd by doxygen1.3-rc3
-- cgit v1.3.1-10-gc9f91