From c0f731e19d61a971af5cf26d073ccd25bfc5c91c Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 13 Apr 2005 12:41:46 +0000 Subject: Added Server::AddGLine Added Server::AddKLine Added Server::AddZLine Added Server::AddQLine Added Server::AddELine Added Server::DelGLine Added Server::DelKLine Added Server::DelZLine Added Server::DelQLine Added Server::DelELine Added Server::Duration git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1071 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/modules_8cpp-source.html | 503 ++++++++++++++++++------------- 1 file changed, 299 insertions(+), 204 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 fd9f62d41..29bf17884 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -187,8 +187,8 @@ 00180 extern chan_hash chanlist; 00181 extern user_hash whowas; 00182 extern command_table cmdlist; -00183 extern file_cache MOTD; -00184 extern file_cache RULES; +00183 extern file_cache MOTD; +00184 extern file_cache RULES; 00185 extern address_cache IP; 00186 00187 @@ -332,12 +332,12 @@ 00325 int Module::OnUserPreNick(userrec* user, std::string newnick) { return 0; }; 00326 void Module::OnUserPostNick(userrec* user, std::string oldnick) { }; 00327 int Module::OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { return ACR_DEFAULT; }; -00328 string_list Module::OnUserSync(userrec* user) { string_list empty; return empty; } -00329 string_list Module::OnChannelSync(chanrec* chan) { string_list empty; return empty; } +00328 string_list Module::OnUserSync(userrec* user) { string_list empty; return empty; } +00329 string_list Module::OnChannelSync(chanrec* chan) { string_list empty; return empty; } 00330 void Module::On005Numeric(std::string &output) { }; 00331 int Module::OnKill(userrec* source, userrec* dest, std::string reason) { return 0; }; 00332 void Module::OnLoadModule(Module* mod,std::string name) { }; -00333 +00333 void Module::OnBackgroundTimer(time_t curtime) { }; 00334 00335 // server is a wrapper class that provides methods to all of the C-style 00336 // exports in the core @@ -379,9 +379,9 @@ 00372 return del_channel(user,cname.c_str(),reason.c_str(),false); 00373 } 00374 -00375 chanuserlist Server::GetUsers(chanrec* chan) +00375 chanuserlist Server::GetUsers(chanrec* chan) 00376 { -00377 chanuserlist userl; +00377 chanuserlist userl; 00378 userl.clear(); 00379 for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) 00380 { @@ -426,12 +426,12 @@ 00419 00420 void Server::AddCommand(char* cmd, handlerfunc f, char flags, int minparams, char* source) 00421 { -00422 createcommand(cmd,f,flags,minparams,source); +00422 createcommand(cmd,f,flags,minparams,source); 00423 } 00424 00425 void Server::SendMode(char **parameters, int pcnt, userrec *user) 00426 { -00427 server_mode(parameters,pcnt,user); +00427 server_mode(parameters,pcnt,user); 00428 } 00429 00430 void Server::Send(int Socket, std::string s) @@ -583,207 +583,302 @@ 00576 } 00577 00578 -00579 ConfigReader::ConfigReader() +00579 bool Server::UserToPseudo(userrec* user,std::string message) 00580 { -00581 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -00582 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); -00583 this->readerror = LoadConf(CONFIG_FILE,this->cache,this->errorlog); -00584 if (!this->readerror) -00585 this->error = CONF_FILE_NOT_FOUND; +00581 unsigned int old_fd = user->fd; +00582 user->fd = FD_MAGIC_NUMBER; +00583 Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str()); +00584 close(old_fd); +00585 shutdown (old_fd,2); 00586 } 00587 -00588 -00589 ConfigReader::~ConfigReader() -00590 { -00591 if (this->cache) -00592 delete this->cache; -00593 if (this->errorlog) -00594 delete this->errorlog; -00595 } -00596 -00597 -00598 ConfigReader::ConfigReader(std::string filename) -00599 { -00600 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -00601 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); -00602 this->readerror = LoadConf(filename.c_str(),this->cache,this->errorlog); -00603 if (!this->readerror) -00604 this->error = CONF_FILE_NOT_FOUND; -00605 }; -00606 -00607 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) -00608 { -00609 char val[MAXBUF]; -00610 char t[MAXBUF]; -00611 char n[MAXBUF]; -00612 strlcpy(t,tag.c_str(),MAXBUF); -00613 strlcpy(n,name.c_str(),MAXBUF); -00614 int res = ReadConf(cache,t,n,index,val); -00615 if (!res) -00616 { -00617 this->error = CONF_VALUE_NOT_FOUND; -00618 return ""; -00619 } -00620 return std::string(val); +00588 bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message) +00589 { +00590 zombie->fd = alive->fd; +00591 alive->fd = FD_MAGIC_NUMBER; +00592 Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick); +00593 kill_link(alive,message.c_str()); +00594 for (int i = 0; i != MAXCHANS; i++) +00595 { +00596 if (zombie->chans[i].channel != NULL) +00597 { +00598 if (zombie->chans[i].channel->name) +00599 { +00600 chanrec* Ptr = zombie->chans[i].channel; +00601 WriteFrom(zombie->fd,zombie,"JOIN %s",Ptr->name); +00602 if (Ptr->topicset) +00603 { +00604 WriteServ(zombie->fd,"332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic); +00605 WriteServ(zombie->fd,"333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset); +00606 } +00607 userlist(zombie,Ptr); +00608 WriteServ(zombie->fd,"366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name); +00609 WriteServ(zombie->fd,"324 %s %s +%s",zombie->nick, Ptr->name,chanmodes(Ptr)); +00610 WriteServ(zombie->fd,"329 %s %s %d", zombie->nick, Ptr->name, Ptr->created); +00611 +00612 } +00613 } +00614 } +00615 +00616 } +00617 +00618 void Server::AddGLine(long duration, std::string source, std::string reason, std::string hostmask) +00619 { +00620 add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); 00621 } 00622 -00623 bool ConfigReader::ReadFlag(std::string tag, std::string name, int index) +00623 void Server::AddQLine(long duration, std::string source, std::string reason, std::string nickname) 00624 { -00625 char val[MAXBUF]; -00626 char t[MAXBUF]; -00627 char n[MAXBUF]; -00628 strlcpy(t,tag.c_str(),MAXBUF); -00629 strlcpy(n,name.c_str(),MAXBUF); -00630 int res = ReadConf(cache,t,n,index,val); -00631 if (!res) -00632 { -00633 this->error = CONF_VALUE_NOT_FOUND; -00634 return false; -00635 } -00636 std::string s = val; -00637 return ((s == "yes") || (s == "YES") || (s == "true") || (s == "TRUE") || (s == "1")); -00638 } -00639 -00640 long ConfigReader::ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned) -00641 { -00642 char val[MAXBUF]; -00643 char t[MAXBUF]; -00644 char n[MAXBUF]; -00645 strlcpy(t,tag.c_str(),MAXBUF); -00646 strlcpy(n,name.c_str(),MAXBUF); -00647 int res = ReadConf(cache,t,n,index,val); -00648 if (!res) -00649 { -00650 this->error = CONF_VALUE_NOT_FOUND; -00651 return 0; -00652 } -00653 for (int i = 0; i < strlen(val); i++) -00654 { -00655 if (!isdigit(val[i])) -00656 { -00657 this->error = CONF_NOT_A_NUMBER; -00658 return 0; -00659 } -00660 } -00661 if ((needs_unsigned) && (atoi(val)<0)) -00662 { -00663 this->error = CONF_NOT_UNSIGNED; -00664 return 0; -00665 } -00666 return atoi(val); -00667 } -00668 -00669 long ConfigReader::GetError() -00670 { -00671 long olderr = this->error; -00672 this->error = 0; -00673 return olderr; -00674 } -00675 -00676 void ConfigReader::DumpErrors(bool bail, userrec* user) -00677 { -00678 if (bail) -00679 { -00680 printf("There were errors in your configuration:\n%s",errorlog->str().c_str()); -00681 exit(0); -00682 } -00683 else -00684 { -00685 char dataline[1024]; -00686 if (user) -00687 { -00688 WriteServ(user->fd,"NOTICE %s :There were errors in the configuration file:",user->nick); -00689 while (!errorlog->eof()) -00690 { -00691 errorlog->getline(dataline,1024); -00692 WriteServ(user->fd,"NOTICE %s :%s",user->nick,dataline); -00693 } -00694 } -00695 else -00696 { -00697 WriteOpers("There were errors in the configuration file:",user->nick); -00698 while (!errorlog->eof()) -00699 { -00700 errorlog->getline(dataline,1024); -00701 WriteOpers(dataline); -00702 } -00703 } -00704 return; -00705 } -00706 } -00707 -00708 -00709 int ConfigReader::Enumerate(std::string tag) -00710 { -00711 return EnumConf(cache,tag.c_str()); -00712 } -00713 -00714 int ConfigReader::EnumerateValues(std::string tag, int index) -00715 { -00716 return EnumValues(cache, tag.c_str(), index); -00717 } -00718 -00719 bool ConfigReader::Verify() -00720 { -00721 return this->readerror; -00722 } -00723 -00724 -00725 FileReader::FileReader(std::string filename) -00726 { -00727 file_cache c; -00728 readfile(c,filename.c_str()); -00729 this->fc = c; -00730 } -00731 -00732 FileReader::FileReader() -00733 { -00734 } -00735 -00736 void FileReader::LoadFile(std::string filename) -00737 { -00738 file_cache c; -00739 readfile(c,filename.c_str()); -00740 this->fc = c; -00741 } -00742 -00743 -00744 FileReader::~FileReader() -00745 { -00746 } -00747 -00748 bool FileReader::Exists() -00749 { -00750 if (fc.size() == 0) -00751 { -00752 return(false); -00753 } -00754 else -00755 { -00756 return(true); -00757 } -00758 } -00759 -00760 std::string FileReader::GetLine(int x) -00761 { -00762 if ((x<0) || (x>fc.size())) -00763 return ""; -00764 return fc[x]; -00765 } -00766 -00767 int FileReader::FileSize() -00768 { -00769 return fc.size(); -00770 } -00771 -00772 -00773 std::vector<Module*> modules(255); -00774 std::vector<ircd_module*> factory(255); -00775 -00776 int MODCOUNT = -1; -00777 -00778 -
Generated on Sat Apr 9 14:38:25 2005 for InspIRCd by +00625 add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str()); +00626 } +00627 +00628 void Server::AddZLine(long duration, std::string source, std::string reason, std::string ipaddr) +00629 { +00630 add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str()); +00631 } +00632 +00633 void Server::AddKLine(long duration, std::string source, std::string reason, std::string hostmask) +00634 { +00635 add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); +00636 } +00637 +00638 void Server::AddELine(long duration, std::string source, std::string reason, std::string hostmask) +00639 { +00640 add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); +00641 } +00642 +00643 bool Server::DelGLine(std::string hostmask) +00644 { +00645 del_gline(hostmask.c_str()); +00646 } +00647 +00648 bool Server::DelQLine(std::string nickname) +00649 { +00650 del_qline(nickname.c_str()); +00651 } +00652 +00653 bool Server::DelZLine(std::string ipaddr) +00654 { +00655 del_zline(ipaddr.c_str()); +00656 } +00657 +00658 bool Server::DelKLine(std::string hostmask) +00659 { +00660 del_kline(hostmask.c_str()); +00661 } +00662 +00663 bool Server::DelELine(std::string hostmask) +00664 { +00665 del_eline(hostmask.c_str()); +00666 } +00667 +00668 long Server::CalcDuration(std::string delta) +00669 { +00670 return duration(delta.c_str()); +00671 } +00672 +00673 +00674 ConfigReader::ConfigReader() +00675 { +00676 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +00677 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); +00678 this->readerror = LoadConf(CONFIG_FILE,this->cache,this->errorlog); +00679 if (!this->readerror) +00680 this->error = CONF_FILE_NOT_FOUND; +00681 } +00682 +00683 +00684 ConfigReader::~ConfigReader() +00685 { +00686 if (this->cache) +00687 delete this->cache; +00688 if (this->errorlog) +00689 delete this->errorlog; +00690 } +00691 +00692 +00693 ConfigReader::ConfigReader(std::string filename) +00694 { +00695 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +00696 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); +00697 this->readerror = LoadConf(filename.c_str(),this->cache,this->errorlog); +00698 if (!this->readerror) +00699 this->error = CONF_FILE_NOT_FOUND; +00700 }; +00701 +00702 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) +00703 { +00704 char val[MAXBUF]; +00705 char t[MAXBUF]; +00706 char n[MAXBUF]; +00707 strlcpy(t,tag.c_str(),MAXBUF); +00708 strlcpy(n,name.c_str(),MAXBUF); +00709 int res = ReadConf(cache,t,n,index,val); +00710 if (!res) +00711 { +00712 this->error = CONF_VALUE_NOT_FOUND; +00713 return ""; +00714 } +00715 return std::string(val); +00716 } +00717 +00718 bool ConfigReader::ReadFlag(std::string tag, std::string name, int index) +00719 { +00720 char val[MAXBUF]; +00721 char t[MAXBUF]; +00722 char n[MAXBUF]; +00723 strlcpy(t,tag.c_str(),MAXBUF); +00724 strlcpy(n,name.c_str(),MAXBUF); +00725 int res = ReadConf(cache,t,n,index,val); +00726 if (!res) +00727 { +00728 this->error = CONF_VALUE_NOT_FOUND; +00729 return false; +00730 } +00731 std::string s = val; +00732 return ((s == "yes") || (s == "YES") || (s == "true") || (s == "TRUE") || (s == "1")); +00733 } +00734 +00735 long ConfigReader::ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned) +00736 { +00737 char val[MAXBUF]; +00738 char t[MAXBUF]; +00739 char n[MAXBUF]; +00740 strlcpy(t,tag.c_str(),MAXBUF); +00741 strlcpy(n,name.c_str(),MAXBUF); +00742 int res = ReadConf(cache,t,n,index,val); +00743 if (!res) +00744 { +00745 this->error = CONF_VALUE_NOT_FOUND; +00746 return 0; +00747 } +00748 for (int i = 0; i < strlen(val); i++) +00749 { +00750 if (!isdigit(val[i])) +00751 { +00752 this->error = CONF_NOT_A_NUMBER; +00753 return 0; +00754 } +00755 } +00756 if ((needs_unsigned) && (atoi(val)<0)) +00757 { +00758 this->error = CONF_NOT_UNSIGNED; +00759 return 0; +00760 } +00761 return atoi(val); +00762 } +00763 +00764 long ConfigReader::GetError() +00765 { +00766 long olderr = this->error; +00767 this->error = 0; +00768 return olderr; +00769 } +00770 +00771 void ConfigReader::DumpErrors(bool bail, userrec* user) +00772 { +00773 if (bail) +00774 { +00775 printf("There were errors in your configuration:\n%s",errorlog->str().c_str()); +00776 exit(0); +00777 } +00778 else +00779 { +00780 char dataline[1024]; +00781 if (user) +00782 { +00783 WriteServ(user->fd,"NOTICE %s :There were errors in the configuration file:",user->nick); +00784 while (!errorlog->eof()) +00785 { +00786 errorlog->getline(dataline,1024); +00787 WriteServ(user->fd,"NOTICE %s :%s",user->nick,dataline); +00788 } +00789 } +00790 else +00791 { +00792 WriteOpers("There were errors in the configuration file:",user->nick); +00793 while (!errorlog->eof()) +00794 { +00795 errorlog->getline(dataline,1024); +00796 WriteOpers(dataline); +00797 } +00798 } +00799 return; +00800 } +00801 } +00802 +00803 +00804 int ConfigReader::Enumerate(std::string tag) +00805 { +00806 return EnumConf(cache,tag.c_str()); +00807 } +00808 +00809 int ConfigReader::EnumerateValues(std::string tag, int index) +00810 { +00811 return EnumValues(cache, tag.c_str(), index); +00812 } +00813 +00814 bool ConfigReader::Verify() +00815 { +00816 return this->readerror; +00817 } +00818 +00819 +00820 FileReader::FileReader(std::string filename) +00821 { +00822 file_cache c; +00823 readfile(c,filename.c_str()); +00824 this->fc = c; +00825 } +00826 +00827 FileReader::FileReader() +00828 { +00829 } +00830 +00831 void FileReader::LoadFile(std::string filename) +00832 { +00833 file_cache c; +00834 readfile(c,filename.c_str()); +00835 this->fc = c; +00836 } +00837 +00838 +00839 FileReader::~FileReader() +00840 { +00841 } +00842 +00843 bool FileReader::Exists() +00844 { +00845 if (fc.size() == 0) +00846 { +00847 return(false); +00848 } +00849 else +00850 { +00851 return(true); +00852 } +00853 } +00854 +00855 std::string FileReader::GetLine(int x) +00856 { +00857 if ((x<0) || (x>fc.size())) +00858 return ""; +00859 return fc[x]; +00860 } +00861 +00862 int FileReader::FileSize() +00863 { +00864 return fc.size(); +00865 } +00866 +00867 +00868 std::vector<Module*> modules(255); +00869 std::vector<ircd_module*> factory(255); +00870 +00871 int MODCOUNT = -1; +00872 +00873 +
Generated on Wed Apr 13 12:32:16 2005 for InspIRCd by doxygen 1.3.3
-- cgit v1.2.3