diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-23 14:06:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-23 14:06:57 +0000 |
commit | 371daf9928def23164b49b39ced1d3cdeb9225b8 (patch) | |
tree | e786547ee80ef75eba14e0bb9c67b725bfae21fe /src/helperfuncs.cpp | |
parent | 089cf1f5fd2ca1d2ca9d49db3c646ecbede67167 (diff) |
Refactored /RESTART (and added InspIRCd::Restart(reason))
Fixed bug in m_ziplinks, assigning instead of testing a var (gcc 4.1.1 picked up on this, 3.4 didnt)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6067 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r-- | src/helperfuncs.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index dab21744a..9ddfe338f 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -274,20 +274,24 @@ chanrec* InspIRCd::FindChan(const std::string &chan) * sends out an error notice to all connected clients (not to be used * lightly!) */ -void InspIRCd::SendError(const char *s) +void InspIRCd::SendError(const std::string &s) { for (std::vector<userrec*>::const_iterator i = this->local_users.begin(); i != this->local_users.end(); i++) { - userrec* t = (userrec*)(*i); - if (t->registered == REG_ALL) + if ((*i)->registered == REG_ALL) { - t->WriteServ("NOTICE %s :%s",t->nick,s); + (*i)->WriteServ("NOTICE %s :%s",(*i)->nick,s.c_str()); } else { - // fix - unregistered connections receive ERROR, not NOTICE - t->Write("ERROR :%s",s); + /* Unregistered connections receive ERROR, not a NOTICE */ + (*i)->Write("ERROR :" + s); } + /* This might generate a whole load of EAGAIN, but we dont really + * care about this, as if we call SendError something catastrophic + * has occured anyway, and we wont receive the events for these. + */ + (*i)->FlushWriteBuf(); } } @@ -423,11 +427,15 @@ bool InspIRCd::IsNick(const char* n) void InspIRCd::OpenLog(char** argv, int argc) { + Config->MyDir = ServerConfig::GetFullProgDir(argv,argc); + Config->argv = argv; + Config->argc = argc; + if (!*this->LogFileName) { if (Config->logpath == "") { - Config->logpath = ServerConfig::GetFullProgDir(argv,argc) + "/ircd.log"; + Config->logpath = Config->MyDir + "/ircd.log"; } Config->log_file = fopen(Config->logpath.c_str(),"a+"); |