1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
19 #include "inspircd_config.h"
21 #include "inspircd_io.h"
23 #include <sys/errno.h>
27 #include <ext/hash_map>
45 #include "inspstring.h"
46 #include "helperfuncs.h"
49 #include "socketengine.h"
52 #include "command_parse.h"
54 extern ServerConfig *Config;
55 extern InspIRCd* ServerInstance;
57 extern std::vector<Module*> modules;
58 extern std::vector<ircd_module*> factory;
59 extern std::vector<InspSocket*> module_sockets;
60 extern std::vector<userrec*> local_users;
63 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
65 extern user_hash clientlist;
66 extern chan_hash chanlist;
67 extern command_table cmdlist;
70 // returns true if an extended mode character is in use
71 bool ModeDefined(char modechar, int type)
73 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
75 if ((i->modechar == modechar) && (i->type == type))
83 bool ModeIsListMode(char modechar, int type)
85 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
87 if ((i->modechar == modechar) && (i->type == type) && (i->list == true))
95 bool ModeDefinedOper(char modechar, int type)
97 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
99 if ((i->modechar == modechar) && (i->type == type) && (i->needsoper == true))
107 // returns number of parameters for a custom mode when it is switched on
108 int ModeDefinedOn(char modechar, int type)
110 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
112 if ((i->modechar == modechar) && (i->type == type))
114 return i->params_when_on;
120 // returns number of parameters for a custom mode when it is switched on
121 int ModeDefinedOff(char modechar, int type)
123 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
125 if ((i->modechar == modechar) && (i->type == type))
127 return i->params_when_off;
133 // returns true if an extended mode character is in use
134 bool DoAddExtendedMode(char modechar, int type, bool requires_oper, int params_on, int params_off)
136 if (ModeDefined(modechar,type)) {
139 EMode.push_back(ExtMode(modechar,type,requires_oper,params_on,params_off));
143 // turns a mode into a listmode
144 void ModeMakeList(char modechar)
146 for (ExtModeListIter i = EMode.begin(); i < EMode.end(); i++)
148 if ((i->modechar == modechar) && (i->type == MT_CHANNEL))
157 // version is a simple class for holding a modules version number
159 Version::Version(int major, int minor, int revision, int build, int flags) : Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags) { };
161 // admin is a simple class for holding a server's administrative info
163 Admin::Admin(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { };
165 Request::Request(char* anydata, Module* src, Module* dst) : data(anydata), source(src), dest(dst) { };
167 char* Request::GetData()
172 Module* Request::GetSource()
177 Module* Request::GetDest()
182 char* Request::Send()
186 return dest->OnRequest(this);
194 Event::Event(char* anydata, Module* src, std::string eventid) : data(anydata), source(src), id(eventid) { };
196 char* Event::GetData()
201 Module* Event::GetSource()
208 FOREACH_MOD(I_OnEvent,OnEvent(this));
212 std::string Event::GetEventID()
218 // These declarations define the behavours of the base class Module (which does nothing at all)
220 Module::Module(Server* Me) { }
221 Module::~Module() { }
222 void Module::OnUserConnect(userrec* user) { }
223 void Module::OnUserQuit(userrec* user, std::string message) { }
224 void Module::OnUserDisconnect(userrec* user) { }
225 void Module::OnUserJoin(userrec* user, chanrec* channel) { }
226 void Module::OnUserPart(userrec* user, chanrec* channel, std::string partmessage) { }
227 void Module::OnRehash(std::string parameter) { }
228 void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
229 int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; }
230 int Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { return false; }
231 void Module::OnMode(userrec* user, void* dest, int target_type, std::string text) { };
232 Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR); }
233 void Module::OnOper(userrec* user, std::string opertype) { };
234 void Module::OnInfo(userrec* user) { };
235 void Module::OnWhois(userrec* source, userrec* dest) { };
236 int Module::OnUserPreInvite(userrec* source,userrec* dest,chanrec* channel) { return 0; };
237 int Module::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text) { return 0; };
238 int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text) { return 0; };
239 int Module::OnUserPreNick(userrec* user, std::string newnick) { return 0; };
240 void Module::OnUserPostNick(userrec* user, std::string oldnick) { };
241 int Module::OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { return ACR_DEFAULT; };
242 void Module::On005Numeric(std::string &output) { };
243 int Module::OnKill(userrec* source, userrec* dest, std::string reason) { return 0; };
244 void Module::OnLoadModule(Module* mod,std::string name) { };
245 void Module::OnUnloadModule(Module* mod,std::string name) { };
246 void Module::OnBackgroundTimer(time_t curtime) { };
247 void Module::OnSendList(userrec* user, chanrec* channel, char mode) { };
248 int Module::OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user, bool validated) { return 0; };
249 bool Module::OnCheckReady(userrec* user) { return true; };
250 void Module::OnUserRegister(userrec* user) { };
251 int Module::OnUserPreKick(userrec* source, userrec* user, chanrec* chan, std::string reason) { return 0; };
252 void Module::OnUserKick(userrec* source, userrec* user, chanrec* chan, std::string reason) { };
253 int Module::OnRawMode(userrec* user, chanrec* chan, char mode, std::string param, bool adding, int pcnt) { return 0; };
254 int Module::OnCheckInvite(userrec* user, chanrec* chan) { return 0; };
255 int Module::OnCheckKey(userrec* user, chanrec* chan, std::string keygiven) { return 0; };
256 int Module::OnCheckLimit(userrec* user, chanrec* chan) { return 0; };
257 int Module::OnCheckBan(userrec* user, chanrec* chan) { return 0; };
258 int Module::OnStats(char symbol, userrec* user) { return 0; };
259 int Module::OnChangeLocalUserHost(userrec* user, std::string newhost) { return 0; };
260 int Module::OnChangeLocalUserGECOS(userrec* user, std::string newhost) { return 0; };
261 int Module::OnLocalTopicChange(userrec* user, chanrec* chan, std::string topic) { return 0; };
262 void Module::OnEvent(Event* event) { return; };
263 char* Module::OnRequest(Request* request) { return NULL; };
264 int Module::OnOperCompare(std::string password, std::string input) { return 0; };
265 void Module::OnGlobalOper(userrec* user) { };
266 void Module::OnGlobalConnect(userrec* user) { };
267 int Module::OnAddBan(userrec* source, chanrec* channel,std::string banmask) { return 0; };
268 int Module::OnDelBan(userrec* source, chanrec* channel,std::string banmask) { return 0; };
269 void Module::OnRawSocketAccept(int fd, std::string ip, int localport) { };
270 int Module::OnRawSocketWrite(int fd, char* buffer, int count) { return 0; };
271 void Module::OnRawSocketClose(int fd) { };
272 int Module::OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult) { return 0; };
273 void Module::OnUserMessage(userrec* user, void* dest, int target_type, std::string text) { };
274 void Module::OnUserNotice(userrec* user, void* dest, int target_type, std::string text) { };
275 void Module::OnRemoteKill(userrec* source, userrec* dest, std::string reason) { };
276 void Module::OnUserInvite(userrec* source,userrec* dest,chanrec* channel) { };
277 void Module::OnPostLocalTopicChange(userrec* user, chanrec* chan, std::string topic) { };
278 void Module::OnGetServerDescription(std::string servername,std::string &description) { };
279 void Module::OnSyncUser(userrec* user, Module* proto, void* opaque) { };
280 void Module::OnSyncChannel(chanrec* chan, Module* proto, void* opaque) { };
281 void Module::ProtoSendMode(void* opaque, int target_type, void* target, std::string modeline) { };
282 void Module::OnSyncChannelMetaData(chanrec* chan, Module* proto,void* opaque, std::string extname) { };
283 void Module::OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, std::string extname) { };
284 void Module::OnDecodeMetaData(int target_type, void* target, std::string extname, std::string extdata) { };
285 void Module::ProtoSendMetaData(void* opaque, int target_type, void* target, std::string extname, std::string extdata) { };
286 void Module::OnWallops(userrec* user, std::string text) { };
287 void Module::OnChangeHost(userrec* user, std::string newhost) { };
288 void Module::OnChangeName(userrec* user, std::string gecos) { };
289 void Module::OnAddGLine(long duration, userrec* source, std::string reason, std::string hostmask) { };
290 void Module::OnAddZLine(long duration, userrec* source, std::string reason, std::string ipmask) { };
291 void Module::OnAddKLine(long duration, userrec* source, std::string reason, std::string hostmask) { };
292 void Module::OnAddQLine(long duration, userrec* source, std::string reason, std::string nickmask) { };
293 void Module::OnAddELine(long duration, userrec* source, std::string reason, std::string hostmask) { };
294 void Module::OnDelGLine(userrec* source, std::string hostmask) { };
295 void Module::OnDelZLine(userrec* source, std::string ipmask) { };
296 void Module::OnDelKLine(userrec* source, std::string hostmask) { };
297 void Module::OnDelQLine(userrec* source, std::string nickmask) { };
298 void Module::OnDelELine(userrec* source, std::string hostmask) { };
299 void Module::OnCleanup(int target_type, void* item) { };
300 void Module::Implements(char* Implements) { for (int j = 0; j < 255; j++) Implements[j] = 0; };
301 Priority Module::Prioritize() { return PRIORITY_DONTCARE; }
303 /* server is a wrapper class that provides methods to all of the C-style
304 * exports in the core
315 void Server::AddSocket(InspSocket* sock)
317 module_sockets.push_back(sock);
320 void Server::RemoveSocket(InspSocket* sock)
322 for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
324 InspSocket* s = (InspSocket*)*a;
327 log(DEBUG,"Forcibly removed socket");
328 ServerInstance->SE->DelFd(s->GetFd());
330 module_sockets.erase(a);
337 void Server::RehashServer()
339 WriteOpers("*** Rehashing config file");
340 Config->Read(false,NULL);
343 ServerConfig* Server::GetConfig()
348 std::string Server::GetVersion()
350 return ServerInstance->GetVersionString();
353 void Server::DelSocket(InspSocket* sock)
355 for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
359 module_sockets.erase(a);
365 void Server::SendOpers(std::string s)
367 WriteOpers("%s",s.c_str());
370 bool Server::MatchText(std::string sliteral, std::string spattern)
372 char literal[MAXBUF],pattern[MAXBUF];
373 strlcpy(literal,sliteral.c_str(),MAXBUF);
374 strlcpy(pattern,spattern.c_str(),MAXBUF);
375 return match(literal,pattern);
378 void Server::SendToModeMask(std::string modes, int flags, std::string text)
380 WriteMode(modes.c_str(),flags,"%s",text.c_str());
383 chanrec* Server::JoinUserToChannel(userrec* user, std::string cname, std::string key)
385 return add_channel(user,cname.c_str(),key.c_str(),false);
388 chanrec* Server::PartUserFromChannel(userrec* user, std::string cname, std::string reason)
390 return del_channel(user,cname.c_str(),reason.c_str(),false);
393 chanuserlist Server::GetUsers(chanrec* chan)
397 std::map<char*,char*> *list = chan->GetUsers();
398 for (std::map<char*,char*>::iterator i = list->begin(); i != list->end(); i++)
401 userl.push_back((userrec*)o);
405 void Server::ChangeUserNick(userrec* user, std::string nickname)
407 force_nickchange(user,nickname.c_str());
410 void Server::QuitUser(userrec* user, std::string reason)
412 kill_link(user,reason.c_str());
415 bool Server::IsUlined(std::string server)
417 return is_uline(server.c_str());
420 void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user)
422 ServerInstance->Parser->CallHandler(commandname,parameters,pcnt,user);
425 bool Server::IsValidModuleCommand(std::string commandname, int pcnt, userrec* user)
427 return ServerInstance->Parser->IsValidCommand(commandname, pcnt, user);
430 void Server::Log(int level, std::string s)
432 log(level,"%s",s.c_str());
435 void Server::AddCommand(command_t *f)
437 ServerInstance->Parser->CreateCommand(f);
440 void Server::SendMode(char **parameters, int pcnt, userrec *user)
442 ServerInstance->ModeGrok->ServerMode(parameters,pcnt,user);
445 void Server::Send(int Socket, std::string s)
447 Write_NoFormat(Socket,s.c_str());
450 void Server::SendServ(int Socket, std::string s)
452 WriteServ_NoFormat(Socket,s.c_str());
455 void Server::SendFrom(int Socket, userrec* User, std::string s)
457 WriteFrom_NoFormat(Socket,User,s.c_str());
460 void Server::SendTo(userrec* Source, userrec* Dest, std::string s)
464 // if source is NULL, then the message originates from the local server
465 Write(Dest->fd,":%s %s",this->GetServerName().c_str(),s.c_str());
469 // otherwise it comes from the user specified
470 WriteTo_NoFormat(Source,Dest,s.c_str());
474 void Server::SendChannelServerNotice(std::string ServName, chanrec* Channel, std::string text)
476 WriteChannelWithServ_NoFormat((char*)ServName.c_str(), Channel, text.c_str());
479 void Server::SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender)
483 WriteChannel_NoFormat(Channel,User,s.c_str());
487 ChanExceptSender_NoFormat(Channel,User,s.c_str());
491 bool Server::CommonChannels(userrec* u1, userrec* u2)
493 return (common_channels(u1,u2) != 0);
496 void Server::SendCommon(userrec* User, std::string text,bool IncludeSender)
500 WriteCommon_NoFormat(User,text.c_str());
504 WriteCommonExcept_NoFormat(User,text.c_str());
508 void Server::SendWallops(userrec* User, std::string text)
510 WriteWallOps(User,false,"%s",text.c_str());
513 void Server::ChangeHost(userrec* user, std::string host)
515 ChangeDisplayedHost(user,host.c_str());
518 void Server::ChangeGECOS(userrec* user, std::string gecos)
520 ChangeName(user,gecos.c_str());
523 bool Server::IsNick(std::string nick)
525 return (isnick(nick.c_str()) != 0);
528 userrec* Server::FindNick(std::string nick)
533 userrec* Server::FindDescriptor(int socket)
535 return (socket < 65536 ? fd_ref_table[socket] : NULL);
538 chanrec* Server::FindChannel(std::string channel)
540 return FindChan(channel.c_str());
543 std::string Server::ChanMode(userrec* User, chanrec* Chan)
545 return cmode(User,Chan);
548 bool Server::IsOnChannel(userrec* User, chanrec* Chan)
550 return has_channel(User,Chan);
553 std::string Server::GetServerName()
555 return Config->ServerName;
558 std::string Server::GetNetworkName()
560 return Config->Network;
563 std::string Server::GetServerDescription()
565 return Config->ServerDesc;
568 Admin Server::GetAdmin()
570 return Admin(Config->AdminName,Config->AdminEmail,Config->AdminNick);
575 bool Server::AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off)
577 if (((modechar >= 'A') && (modechar <= 'Z')) || ((modechar >= 'a') && (modechar <= 'z')))
579 if (type == MT_SERVER)
581 log(DEBUG,"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion");
584 if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT))
586 log(DEBUG,"*** API ERROR *** Parameters on MT_CLIENT modes are not supported");
589 if ((params_when_on>1) || (params_when_off>1))
591 log(DEBUG,"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported");
594 return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off);
598 log(DEBUG,"*** API ERROR *** Muppet modechar detected.");
603 bool Server::AddExtendedListMode(char modechar)
605 bool res = DoAddExtendedMode(modechar,MT_CHANNEL,false,1,1);
607 ModeMakeList(modechar);
611 int Server::CountUsers(chanrec* c)
617 bool Server::UserToPseudo(userrec* user,std::string message)
619 unsigned int old_fd = user->fd;
620 Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
621 user->FlushWriteBuf();
623 user->fd = FD_MAGIC_NUMBER;
625 if (find(local_users.begin(),local_users.end(),user) != local_users.end())
627 local_users.erase(find(local_users.begin(),local_users.end(),user));
628 log(DEBUG,"Delete local user");
631 ServerInstance->SE->DelFd(old_fd);
637 bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
639 log(DEBUG,"PseudoToUser");
640 zombie->fd = alive->fd;
641 FOREACH_MOD(I_OnUserQuit,OnUserQuit(alive,message));
642 alive->fd = FD_MAGIC_NUMBER;
643 alive->FlushWriteBuf();
644 alive->ClearBuffer();
645 Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick);
646 kill_link(alive,message.c_str());
648 if (find(local_users.begin(),local_users.end(),alive) != local_users.end())
650 local_users.erase(find(local_users.begin(),local_users.end(),alive));
651 log(DEBUG,"Delete local user");
654 fd_ref_table[zombie->fd] = zombie;
655 for (unsigned int i = 0; i < zombie->chans.size(); i++)
657 if (zombie->chans[i].channel != NULL)
659 if (zombie->chans[i].channel->name)
661 chanrec* Ptr = zombie->chans[i].channel;
662 WriteFrom(zombie->fd,zombie,"JOIN %s",Ptr->name);
665 WriteServ(zombie->fd,"332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
666 WriteServ(zombie->fd,"333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
668 userlist(zombie,Ptr);
669 WriteServ(zombie->fd,"366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
674 if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->fd != FD_MAGIC_NUMBER))
675 local_users.push_back(zombie);
680 void Server::AddGLine(long duration, std::string source, std::string reason, std::string hostmask)
682 add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
685 void Server::AddQLine(long duration, std::string source, std::string reason, std::string nickname)
687 add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str());
690 void Server::AddZLine(long duration, std::string source, std::string reason, std::string ipaddr)
692 add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str());
695 void Server::AddKLine(long duration, std::string source, std::string reason, std::string hostmask)
697 add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
700 void Server::AddELine(long duration, std::string source, std::string reason, std::string hostmask)
702 add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
705 bool Server::DelGLine(std::string hostmask)
707 return del_gline(hostmask.c_str());
710 bool Server::DelQLine(std::string nickname)
712 return del_qline(nickname.c_str());
715 bool Server::DelZLine(std::string ipaddr)
717 return del_zline(ipaddr.c_str());
720 bool Server::DelKLine(std::string hostmask)
722 return del_kline(hostmask.c_str());
725 bool Server::DelELine(std::string hostmask)
727 return del_eline(hostmask.c_str());
730 long Server::CalcDuration(std::string delta)
732 return duration(delta.c_str());
735 bool Server::IsValidMask(std::string mask)
737 const char* dest = mask.c_str();
738 if (strchr(dest,'!')==0)
740 if (strchr(dest,'@')==0)
742 for (unsigned int i = 0; i < strlen(dest); i++)
745 for (unsigned int i = 0; i < strlen(dest); i++)
749 for (unsigned int i = 0; i < strlen(dest); i++)
755 for (unsigned int i = 0; i < strlen(dest); i++)
764 Module* Server::FindModule(std::string name)
766 for (int i = 0; i <= MODCOUNT; i++)
768 if (Config->module_names[i] == name)
776 ConfigReader::ConfigReader()
778 Config->ClearStack();
779 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
780 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
781 this->readerror = Config->LoadConf(CONFIG_FILE,this->cache,this->errorlog);
782 if (!this->readerror)
783 this->error = CONF_FILE_NOT_FOUND;
787 ConfigReader::~ConfigReader()
792 delete this->errorlog;
796 ConfigReader::ConfigReader(std::string filename)
798 Config->ClearStack();
799 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
800 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
801 this->readerror = Config->LoadConf(filename.c_str(),this->cache,this->errorlog);
802 if (!this->readerror)
803 this->error = CONF_FILE_NOT_FOUND;
806 std::string ConfigReader::ReadValue(std::string tag, std::string name, int index)
811 strlcpy(t,tag.c_str(),MAXBUF);
812 strlcpy(n,name.c_str(),MAXBUF);
813 int res = Config->ReadConf(cache,t,n,index,val);
816 this->error = CONF_VALUE_NOT_FOUND;
822 bool ConfigReader::ReadFlag(std::string tag, std::string name, int index)
827 strlcpy(t,tag.c_str(),MAXBUF);
828 strlcpy(n,name.c_str(),MAXBUF);
829 int res = Config->ReadConf(cache,t,n,index,val);
832 this->error = CONF_VALUE_NOT_FOUND;
836 return ((s == "yes") || (s == "YES") || (s == "true") || (s == "TRUE") || (s == "1"));
839 long ConfigReader::ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned)
844 strlcpy(t,tag.c_str(),MAXBUF);
845 strlcpy(n,name.c_str(),MAXBUF);
846 int res = Config->ReadConf(cache,t,n,index,val);
849 this->error = CONF_VALUE_NOT_FOUND;
852 for (unsigned int i = 0; i < strlen(val); i++)
854 if (!isdigit(val[i]))
856 this->error = CONF_NOT_A_NUMBER;
860 if ((needs_unsigned) && (atoi(val)<0))
862 this->error = CONF_NOT_UNSIGNED;
868 long ConfigReader::GetError()
870 long olderr = this->error;
875 void ConfigReader::DumpErrors(bool bail, userrec* user)
879 printf("There were errors in your configuration:\n%s",errorlog->str().c_str());
887 WriteServ(user->fd,"NOTICE %s :There were errors in the configuration file:",user->nick);
888 while (!errorlog->eof())
890 errorlog->getline(dataline,1024);
891 WriteServ(user->fd,"NOTICE %s :%s",user->nick,dataline);
896 WriteOpers("There were errors in the configuration file:",user->nick);
897 while (!errorlog->eof())
899 errorlog->getline(dataline,1024);
900 WriteOpers(dataline);
908 int ConfigReader::Enumerate(std::string tag)
910 return Config->EnumConf(cache,tag.c_str());
913 int ConfigReader::EnumerateValues(std::string tag, int index)
915 return Config->EnumValues(cache, tag.c_str(), index);
918 bool ConfigReader::Verify()
920 return this->readerror;
924 FileReader::FileReader(std::string filename)
927 readfile(c,filename.c_str());
931 FileReader::FileReader()
935 void FileReader::LoadFile(std::string filename)
938 readfile(c,filename.c_str());
943 FileReader::~FileReader()
947 bool FileReader::Exists()
959 std::string FileReader::GetLine(int x)
961 if ((x<0) || ((unsigned)x>fc.size()))
966 int FileReader::FileSize()
972 std::vector<Module*> modules(255);
973 std::vector<ircd_module*> factory(255);