mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 19:19:02 -04:00
Cached ISUPPORT
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2702 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
3497a78354
commit
df06ab6044
@ -102,7 +102,8 @@ class InspIRCd
|
||||
private:
|
||||
char MODERR[MAXBUF];
|
||||
void erase_factory(int j);
|
||||
void erase_module(int j);
|
||||
void erase_module(int j);
|
||||
void BuildISupport();
|
||||
|
||||
public:
|
||||
time_t startup_time;
|
||||
|
@ -263,6 +263,12 @@ class ServerConfig : public classbase
|
||||
*/
|
||||
std::map<int,Module*> IOHookModule;
|
||||
|
||||
/** The 005 tokens of this server (ISUPPORT)
|
||||
* populated/repopulated upon loading or unloading
|
||||
* modules.
|
||||
*/
|
||||
std::string data005;
|
||||
|
||||
ServerConfig();
|
||||
|
||||
/** Clears the include stack in preperation for
|
||||
|
@ -276,6 +276,16 @@ void InspIRCd::erase_module(int j)
|
||||
|
||||
}
|
||||
|
||||
void InspIRCd::BuildISupport()
|
||||
{
|
||||
// the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
|
||||
std::stringstream v;
|
||||
v << "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+ MAP SAFELIST MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 NICKLEN=" << NICKMAX;
|
||||
v << " TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=20 AWAYLEN=" << MAXAWAY << " CHANMODES=ohvb,k,l,psmnti NETWORK=" << Config->Network;
|
||||
Config->data005 = v.str();
|
||||
FOREACH_MOD(I_On005Numeric,On005Numeric(Config->data005));
|
||||
}
|
||||
|
||||
bool InspIRCd::UnloadModule(const char* filename)
|
||||
{
|
||||
std::string filename_str = filename;
|
||||
@ -314,6 +324,7 @@ bool InspIRCd::UnloadModule(const char* filename)
|
||||
Parser->RemoveCommands(filename);
|
||||
log(DEFAULT,"Module %s unloaded",filename);
|
||||
MODCOUNT--;
|
||||
BuildISupport();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -402,6 +413,7 @@ bool InspIRCd::LoadModule(const char* filename)
|
||||
#endif
|
||||
MODCOUNT++;
|
||||
FOREACH_MOD(I_OnLoadModule,OnLoadModule(modules[MODCOUNT],filename_str));
|
||||
BuildISupport();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
|
||||
// irc server at once (or the irc server otherwise initiating this many connections, files etc)
|
||||
// which for the time being is a physical impossibility (even the largest networks dont have more
|
||||
// than about 10,000 users on ONE server!)
|
||||
if ((unsigned)socket > 65534)
|
||||
if ((unsigned)socket > MAX_DESCRIPTORS)
|
||||
{
|
||||
kill_link(clientlist[tempnick],"Server is full");
|
||||
return;
|
||||
@ -632,6 +632,8 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
|
||||
fd_ref_table[socket] = clientlist[tempnick];
|
||||
local_users.push_back(clientlist[tempnick]);
|
||||
ServerInstance->SE->AddFd(socket,true,X_ESTAB_CLIENT);
|
||||
|
||||
WriteServ(clientlist[tempnick]->fd,"NOTICE Auth :*** Looking up your hostname...");
|
||||
}
|
||||
|
||||
void FullConnectUser(userrec* user, CullList* Goners)
|
||||
@ -680,17 +682,9 @@ void FullConnectUser(userrec* user, CullList* Goners)
|
||||
WriteServ(user->fd,"002 %s :Your host is %s, running version %s",user->nick,Config->ServerName,VERSION);
|
||||
WriteServ(user->fd,"003 %s :This server was created %s %s",user->nick,__TIME__,__DATE__);
|
||||
WriteServ(user->fd,"004 %s %s %s iowghraAsORVSxNCWqBzvdHtGI lvhopsmntikrRcaqOALQbSeKVfHGCuzN",user->nick,Config->ServerName,VERSION);
|
||||
// the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
|
||||
std::stringstream v;
|
||||
v << "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+ MAP SAFELIST MAXCHANNELS=" << MAXCHANS;
|
||||
v << " MAXBANS=60 NICKLEN=" << NICKMAX;
|
||||
v << " TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=20 AWAYLEN=" << MAXAWAY << " CHANMODES=ohvb,k,l,psmnti NETWORK=";
|
||||
v << Config->Network;
|
||||
std::string data005 = v.str();
|
||||
FOREACH_MOD(I_On005Numeric,On005Numeric(data005));
|
||||
// anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
|
||||
// so i'd better split it :)
|
||||
std::stringstream out(data005);
|
||||
std::stringstream out(Config->data005);
|
||||
std::string token = "";
|
||||
std::string line5 = "";
|
||||
int token_counter = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user