From 0f2cf28d39404881b9719330ca86757c51b87bad Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 1 May 2004 19:58:59 +0000 Subject: Added documentation of new ConfigReader methods suggested by Azhrarn for sanity git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@772 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/modules_8cpp-source.html | 276 +++++++++++++++++++------------ 1 file changed, 169 insertions(+), 107 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 5d6a33b5e..6e6939978 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -164,8 +164,8 @@ 00156 extern chan_hash chanlist; 00157 extern user_hash whowas; 00158 extern command_table cmdlist; -00159 extern file_cache MOTD; -00160 extern file_cache RULES; +00159 extern file_cache MOTD; +00160 extern file_cache RULES; 00161 extern address_cache IP; 00162 00163 @@ -310,8 +310,8 @@ 00302 int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text) { return 0; }; 00303 int Module::OnUserPreNick(userrec* user, std::string newnick) { return 0; }; 00304 int Module::OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { return ACR_DEFAULT; }; -00305 string_list Module::OnUserSync(userrec* user) { string_list empty; return empty; } -00306 string_list Module::OnChannelSync(chanrec* chan) { string_list empty; return empty; } +00305 string_list Module::OnUserSync(userrec* user) { string_list empty; return empty; } +00306 string_list Module::OnChannelSync(chanrec* chan) { string_list empty; return empty; } 00307 00308 00309 // server is a wrapper class that provides methods to all of the C-style @@ -354,9 +354,9 @@ 00346 return del_channel(user,cname.c_str(),reason.c_str(),false); 00347 } 00348 -00349 chanuserlist Server::GetUsers(chanrec* chan) +00349 chanuserlist Server::GetUsers(chanrec* chan) 00350 { -00351 chanuserlist userl; +00351 chanuserlist userl; 00352 userl.clear(); 00353 for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) 00354 { @@ -401,12 +401,12 @@ 00393 00394 void Server::AddCommand(char* cmd, handlerfunc f, char flags, int minparams) 00395 { -00396 createcommand(cmd,f,flags,minparams); +00396 createcommand(cmd,f,flags,minparams); 00397 } 00398 00399 void Server::SendMode(char **parameters, int pcnt, userrec *user) 00400 { -00401 server_mode(parameters,pcnt,user); +00401 server_mode(parameters,pcnt,user); 00402 } 00403 00404 void Server::Send(int Socket, std::string s) @@ -561,106 +561,168 @@ 00553 ConfigReader::ConfigReader() 00554 { 00555 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -00556 this->error = LoadConf(CONFIG_FILE,this->cache); -00557 } -00558 -00559 -00560 ConfigReader::~ConfigReader() -00561 { -00562 if (this->cache) -00563 delete this->cache; -00564 } -00565 -00566 -00567 ConfigReader::ConfigReader(std::string filename) -00568 { -00569 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -00570 this->error = LoadConf(filename.c_str(),this->cache); -00571 }; -00572 -00573 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) -00574 { -00575 char val[MAXBUF]; -00576 char t[MAXBUF]; -00577 char n[MAXBUF]; -00578 strncpy(t,tag.c_str(),MAXBUF); -00579 strncpy(n,name.c_str(),MAXBUF); -00580 ReadConf(cache,t,n,index,val); -00581 return std::string(val); -00582 } -00583 -00584 -00585 int ConfigReader::Enumerate(std::string tag) -00586 { -00587 return EnumConf(cache,tag.c_str()); -00588 } -00589 -00590 int ConfigReader::EnumerateValues(std::string tag, int index) -00591 { -00592 return EnumValues(cache, tag.c_str(), index); -00593 } -00594 -00595 bool ConfigReader::Verify() -00596 { -00597 return this->error; -00598 } -00599 -00600 -00601 FileReader::FileReader(std::string filename) -00602 { -00603 file_cache c; -00604 readfile(c,filename.c_str()); -00605 this->fc = c; -00606 } -00607 -00608 FileReader::FileReader() -00609 { -00610 } -00611 -00612 void FileReader::LoadFile(std::string filename) -00613 { -00614 file_cache c; -00615 readfile(c,filename.c_str()); -00616 this->fc = c; -00617 } -00618 -00619 -00620 FileReader::~FileReader() -00621 { -00622 } -00623 -00624 bool FileReader::Exists() -00625 { -00626 if (fc.size() == 0) -00627 { -00628 return(false); -00629 } -00630 else -00631 { -00632 return(true); -00633 } -00634 } -00635 -00636 std::string FileReader::GetLine(int x) -00637 { -00638 if ((x<0) || (x>fc.size())) -00639 return ""; -00640 return fc[x]; -00641 } -00642 -00643 int FileReader::FileSize() -00644 { -00645 return fc.size(); -00646 } -00647 -00648 -00649 std::vector<Module*> modules(255); -00650 std::vector<ircd_module*> factory(255); +00556 this->readerror = LoadConf(CONFIG_FILE,this->cache); +00557 if (!this->readerror) +00558 this->error = CONF_FILE_NOT_FOUND; +00559 } +00560 +00561 +00562 ConfigReader::~ConfigReader() +00563 { +00564 if (this->cache) +00565 delete this->cache; +00566 } +00567 +00568 +00569 ConfigReader::ConfigReader(std::string filename) +00570 { +00571 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +00572 this->readerror = LoadConf(filename.c_str(),this->cache); +00573 if (!this->readerror) +00574 this->error = CONF_FILE_NOT_FOUND; +00575 }; +00576 +00577 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) +00578 { +00579 char val[MAXBUF]; +00580 char t[MAXBUF]; +00581 char n[MAXBUF]; +00582 strncpy(t,tag.c_str(),MAXBUF); +00583 strncpy(n,name.c_str(),MAXBUF); +00584 int res = ReadConf(cache,t,n,index,val); +00585 if (!res) +00586 { +00587 this->error = CONF_VALUE_NOT_FOUND; +00588 return ""; +00589 } +00590 return std::string(val); +00591 } +00592 +00593 bool ConfigReader::ReadFlag(std::string tag, std::string name, int index) +00594 { +00595 char val[MAXBUF]; +00596 char t[MAXBUF]; +00597 char n[MAXBUF]; +00598 strncpy(t,tag.c_str(),MAXBUF); +00599 strncpy(n,name.c_str(),MAXBUF); +00600 int res = ReadConf(cache,t,n,index,val); +00601 if (!res) +00602 { +00603 this->error = CONF_VALUE_NOT_FOUND; +00604 return false; +00605 } +00606 std::string s = val; +00607 return ((s == "yes") || (s == "YES") || (s == "true") || (s == "TRUE") || (s == "1")); +00608 } +00609 +00610 long ConfigReader::ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned) +00611 { +00612 char val[MAXBUF]; +00613 char t[MAXBUF]; +00614 char n[MAXBUF]; +00615 strncpy(t,tag.c_str(),MAXBUF); +00616 strncpy(n,name.c_str(),MAXBUF); +00617 int res = ReadConf(cache,t,n,index,val); +00618 if (!res) +00619 { +00620 this->error = CONF_VALUE_NOT_FOUND; +00621 return 0; +00622 } +00623 for (int i = 0; i < strlen(val); i++) +00624 { +00625 if (!isdigit(val[i])) +00626 { +00627 this->error = CONF_NOT_A_NUMBER; +00628 return 0; +00629 } +00630 } +00631 if ((needs_unsigned) && (atoi(val)<0)) +00632 { +00633 this->error = CONF_NOT_UNSIGNED; +00634 return 0; +00635 } +00636 return atoi(val); +00637 } +00638 +00639 long ConfigReader::GetError() +00640 { +00641 long olderr = this->error; +00642 this->error = 0; +00643 return olderr; +00644 } +00645 +00646 +00647 int ConfigReader::Enumerate(std::string tag) +00648 { +00649 return EnumConf(cache,tag.c_str()); +00650 } 00651 -00652 int MODCOUNT = -1; -00653 -00654 -
Generated on Sat May 1 17:50:06 2004 for InspIRCd by +00652 int ConfigReader::EnumerateValues(std::string tag, int index) +00653 { +00654 return EnumValues(cache, tag.c_str(), index); +00655 } +00656 +00657 bool ConfigReader::Verify() +00658 { +00659 return this->readerror; +00660 } +00661 +00662 +00663 FileReader::FileReader(std::string filename) +00664 { +00665 file_cache c; +00666 readfile(c,filename.c_str()); +00667 this->fc = c; +00668 } +00669 +00670 FileReader::FileReader() +00671 { +00672 } +00673 +00674 void FileReader::LoadFile(std::string filename) +00675 { +00676 file_cache c; +00677 readfile(c,filename.c_str()); +00678 this->fc = c; +00679 } +00680 +00681 +00682 FileReader::~FileReader() +00683 { +00684 } +00685 +00686 bool FileReader::Exists() +00687 { +00688 if (fc.size() == 0) +00689 { +00690 return(false); +00691 } +00692 else +00693 { +00694 return(true); +00695 } +00696 } +00697 +00698 std::string FileReader::GetLine(int x) +00699 { +00700 if ((x<0) || (x>fc.size())) +00701 return ""; +00702 return fc[x]; +00703 } +00704 +00705 int FileReader::FileSize() +00706 { +00707 return fc.size(); +00708 } +00709 +00710 +00711 std::vector<Module*> modules(255); +00712 std::vector<ircd_module*> factory(255); +00713 +00714 int MODCOUNT = -1; +00715 +00716 +
Generated on Sat May 1 20:57:47 2004 for InspIRCd by doxygen1.3-rc3
-- cgit v1.3.1-10-gc9f91