From df06ab6044b8a5c7e60220121252cf681733b846 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 29 Dec 2005 21:57:34 +0000 Subject: [PATCH] Cached ISUPPORT git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2702 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 3 ++- include/inspircd_io.h | 6 ++++++ src/inspircd.cpp | 12 ++++++++++++ src/users.cpp | 14 ++++---------- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index 10ab85d4e..e41482341 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -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; diff --git a/include/inspircd_io.h b/include/inspircd_io.h index 268ad09bb..76398a6e2 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -263,6 +263,12 @@ class ServerConfig : public classbase */ std::map 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 diff --git a/src/inspircd.cpp b/src/inspircd.cpp index dc3c777fe..ed1c8fda8 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -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; } diff --git a/src/users.cpp b/src/users.cpp index 8bd8104d0..a36ad96f7 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -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; -- 2.39.5