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 -
1.3.3
--
cgit v1.3.1-10-gc9f91