mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
Improve the way 005 ISUPPORT is sent to users when they connect, cache it in a much more sane format which is much simpler to spool to them
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5978 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
15e70c8fe6
commit
f240285155
@ -453,6 +453,7 @@ class ServerConfig : public Extensible
|
|||||||
* modules.
|
* modules.
|
||||||
*/
|
*/
|
||||||
std::string data005;
|
std::string data005;
|
||||||
|
std::vector<std::string> isupport;
|
||||||
|
|
||||||
/** STATS characters in this list are available
|
/** STATS characters in this list are available
|
||||||
* only to operators.
|
* only to operators.
|
||||||
@ -504,6 +505,14 @@ class ServerConfig : public Extensible
|
|||||||
*/
|
*/
|
||||||
void ClearStack();
|
void ClearStack();
|
||||||
|
|
||||||
|
/** Update the 005 vector
|
||||||
|
*/
|
||||||
|
void Update005();
|
||||||
|
|
||||||
|
/** Send the 005 numerics (ISUPPORT) to a user
|
||||||
|
*/
|
||||||
|
void Send005(userrec* user);
|
||||||
|
|
||||||
/** Read the entire configuration into memory
|
/** Read the entire configuration into memory
|
||||||
* and initialize this class. All other methods
|
* and initialize this class. All other methods
|
||||||
* should be used only by the core.
|
* should be used only by the core.
|
||||||
|
@ -28,26 +28,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
|
|||||||
|
|
||||||
CmdResult cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
|
CmdResult cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
|
||||||
{
|
{
|
||||||
std::stringstream out(ServerInstance->Config->data005);
|
|
||||||
std::string token = "";
|
|
||||||
std::string line5 = "";
|
|
||||||
int token_counter = 0;
|
|
||||||
|
|
||||||
user->WriteServ("351 %s :%s",user->nick,ServerInstance->GetVersionString().c_str());
|
user->WriteServ("351 %s :%s",user->nick,ServerInstance->GetVersionString().c_str());
|
||||||
|
ServerInstance->Config->Send005(user);
|
||||||
while (!out.eof())
|
|
||||||
{
|
|
||||||
out >> token;
|
|
||||||
line5 = line5 + token + " ";
|
|
||||||
token_counter++;
|
|
||||||
|
|
||||||
if ((token_counter >= 13) || (out.eof() == true))
|
|
||||||
{
|
|
||||||
user->WriteServ("005 %s %s:are supported by this server",user->nick,line5.c_str());
|
|
||||||
line5 = "";
|
|
||||||
token_counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,37 @@ bool ServerConfig::DelIOHook(InspSocket* is)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerConfig::Update005()
|
||||||
|
{
|
||||||
|
std::stringstream out(data005);
|
||||||
|
std::string token;
|
||||||
|
std::string line5;
|
||||||
|
int token_counter = 0;
|
||||||
|
isupport.clear();
|
||||||
|
while (out >> token)
|
||||||
|
{
|
||||||
|
line5 = line5 + token + " ";
|
||||||
|
token_counter++;
|
||||||
|
if (token_counter >= 13)
|
||||||
|
{
|
||||||
|
char buf[MAXBUF];
|
||||||
|
snprintf(buf, MAXBUF, "%s:are supported by this server", line5.c_str());
|
||||||
|
isupport.push_back(buf);
|
||||||
|
line5 = "";
|
||||||
|
token_counter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char buf[MAXBUF];
|
||||||
|
snprintf(buf, MAXBUF, "%s:are supported by this server", line5.c_str());
|
||||||
|
isupport.push_back(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerConfig::Send005(userrec* user)
|
||||||
|
{
|
||||||
|
for (std::vector<std::string>::iterator line = ServerInstance->Config->isupport.begin(); line != ServerInstance->Config->isupport.end(); line++)
|
||||||
|
user->WriteServ("005 %s %s", user->nick, line->c_str());
|
||||||
|
}
|
||||||
|
|
||||||
bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
|
bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
|
||||||
{
|
{
|
||||||
int count = ConfValueEnum(this->config_data, tag);
|
int count = ConfValueEnum(this->config_data, tag);
|
||||||
|
@ -490,6 +490,7 @@ void InspIRCd::BuildISupport()
|
|||||||
v << MAXAWAY << " CHANMODES=" << this->Modes->ChanModes() << " FNC NETWORK=" << Config->Network << " MAXPARA=32";
|
v << MAXAWAY << " CHANMODES=" << this->Modes->ChanModes() << " FNC NETWORK=" << Config->Network << " MAXPARA=32";
|
||||||
Config->data005 = v.str();
|
Config->data005 = v.str();
|
||||||
FOREACH_MOD_I(this,I_On005Numeric,On005Numeric(Config->data005));
|
FOREACH_MOD_I(this,I_On005Numeric,On005Numeric(Config->data005));
|
||||||
|
Config->Update005();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InspIRCd::UnloadModule(const char* filename)
|
bool InspIRCd::UnloadModule(const char* filename)
|
||||||
|
@ -4677,24 +4677,7 @@ class ModuleSpanningTree : public Module
|
|||||||
user->WriteServ("351 %s :%s",user->nick,Version.c_str());
|
user->WriteServ("351 %s :%s",user->nick,Version.c_str());
|
||||||
if (found == Utils->TreeRoot)
|
if (found == Utils->TreeRoot)
|
||||||
{
|
{
|
||||||
std::stringstream out(ServerInstance->Config->data005);
|
ServerInstance->Config->Send005(user);
|
||||||
std::string token = "";
|
|
||||||
std::string line5 = "";
|
|
||||||
int token_counter = 0;
|
|
||||||
|
|
||||||
while (!out.eof())
|
|
||||||
{
|
|
||||||
out >> token;
|
|
||||||
line5 = line5 + token + " ";
|
|
||||||
token_counter++;
|
|
||||||
|
|
||||||
if ((token_counter >= 13) || (out.eof() == true))
|
|
||||||
{
|
|
||||||
user->WriteServ("005 %s %s:are supported by this server",user->nick,line5.c_str());
|
|
||||||
line5 = "";
|
|
||||||
token_counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1212,27 +1212,8 @@ void userrec::FullConnect(CullList* Goners)
|
|||||||
this->WriteServ("003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__);
|
this->WriteServ("003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__);
|
||||||
this->WriteServ("004 %s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str());
|
this->WriteServ("004 %s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str());
|
||||||
|
|
||||||
// anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
|
ServerInstance->Config->Send005(this);
|
||||||
// so i'd better split it :)
|
|
||||||
std::stringstream out(ServerInstance->Config->data005);
|
|
||||||
std::string token = "";
|
|
||||||
std::string line5 = "";
|
|
||||||
int token_counter = 0;
|
|
||||||
|
|
||||||
while (!out.eof())
|
|
||||||
{
|
|
||||||
out >> token;
|
|
||||||
line5 = line5 + token + " ";
|
|
||||||
token_counter++;
|
|
||||||
|
|
||||||
if ((token_counter >= 13) || (out.eof() == true))
|
|
||||||
{
|
|
||||||
this->WriteServ("005 %s %s:are supported by this server", this->nick, line5.c_str());
|
|
||||||
line5 = "";
|
|
||||||
token_counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->ShowMOTD();
|
this->ShowMOTD();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user