1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "exitcodes.h"
19 void InspIRCd::SignalHandler(int signal)
32 void InspIRCd::Exit(int status)
39 this->SendError("Exiting with status " + ConvToStr(status) + " (" + std::string(ExitCodes[status]) + ")");
45 void InspIRCd::Rehash()
47 this->WriteOpers("*** Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(this->ConfigFileName));
49 this->OpenLog(this->Config->argv, this->Config->argc);
50 this->RehashUsersAndChans();
51 FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect());
52 this->Config->Read(false,NULL);
55 FOREACH_MOD_I(this,I_OnRehash,OnRehash(NULL,""));
56 this->BuildISupport();
59 void InspIRCd::RehashServer()
61 this->WriteOpers("*** Rehashing config file");
62 this->RehashUsersAndChans();
63 this->Config->Read(false,NULL);
68 std::string InspIRCd::GetVersionString()
70 char versiondata[MAXBUF];
71 char dnsengine[] = "singlethread-object";
73 if (*Config->CustomVersion)
75 snprintf(versiondata,MAXBUF,"%s %s :%s",VERSION,Config->ServerName,Config->CustomVersion);
79 snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%s,%s,%s]",VERSION,Config->ServerName,SYSTEM,REVISION,SE->GetName().c_str(),dnsengine);
84 void InspIRCd::BuildISupport()
86 // the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
88 v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES-1 << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << Config->MaxChans << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
89 v << " CASEMAPPING=rfc1459 STATUSMSG=@%+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=" << Config->MaxTargets << " AWAYLEN=";
90 v << MAXAWAY << " CHANMODES=" << this->Modes->ChanModes() << " FNC NETWORK=" << Config->Network << " MAXPARA=32 ELIST=MU";
91 Config->data005 = v.str();
92 FOREACH_MOD_I(this,I_On005Numeric,On005Numeric(Config->data005));
96 std::string InspIRCd::GetRevision()
101 void InspIRCd::AddServerName(const std::string &servername)
103 servernamelist::iterator itr = servernames.begin();
104 for(; itr != servernames.end(); ++itr)
105 if(**itr == servername)
108 string * ns = new string(servername);
109 servernames.push_back(ns);
112 const char* InspIRCd::FindServerNamePtr(const std::string &servername)
114 servernamelist::iterator itr = servernames.begin();
115 for(; itr != servernames.end(); ++itr)
116 if(**itr == servername)
117 return (*itr)->c_str();
119 servernames.push_back(new string(servername));
120 itr = --servernames.end();
121 return (*itr)->c_str();
124 bool InspIRCd::FindServerName(const std::string &servername)
126 servernamelist::iterator itr = servernames.begin();
127 for(; itr != servernames.end(); ++itr)
128 if(**itr == servername)