summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp9
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp20
-rw-r--r--src/modules/m_spanningtree/utils.cpp27
-rw-r--r--src/modules/m_spanningtree/utils.h9
4 files changed, 64 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index e6c9eeb49..30fc0fa79 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -889,6 +889,13 @@ bool TreeSocket::IntroduceClient(const std::string &source, std::deque<std::stri
cmd_validation valid[] = { {"Nickname", 1, NICKMAX}, {"Hostname", 2, 64}, {"Displayed hostname", 3, 64}, {"Ident", 4, IDENTMAX}, {"GECOS", 7, MAXGECOS}, {"", 0, 0} };
+ TreeServer* remoteserver = Utils->FindServer(source);
+ if (!remoteserver)
+ {
+ this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" KILL "+params[1]+" :Invalid client introduction (Unknown server "+source+")");
+ return true;
+ }
+
/* Check parameters for validity before introducing the client, discovered by dmb */
if (!age)
{
@@ -955,7 +962,7 @@ bool TreeSocket::IntroduceClient(const std::string &source, std::deque<std::stri
Instance->AddGlobalClone(_new);
- bool send = !((this->Utils->quiet_bursts && this->bursting) || (this->Instance->SilentULine(_new->server)));
+ bool send = !(((this->Utils->quiet_bursts) && (this->bursting || Utils->FindRemoteBurstServer(remoteserver))) || (this->Instance->SilentULine(_new->server)));
if (send)
this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]",_new->server,_new->nick,_new->ident,_new->host, _new->GetIPString(), _new->fullname);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 80503659a..31585d7f5 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -456,6 +456,8 @@ bool TreeSocket::MetaData(const std::string &prefix, std::deque<std::string> &pa
TreeServer* ServerSource = Utils->FindServer(prefix);
if (ServerSource)
{
+ Utils->SetRemoteBursting(ServerSource, false);
+
if (params[0] == "*")
{
FOREACH_MOD_I(this->Instance,I_OnDecodeMetaData,OnDecodeMetaData(TYPE_OTHER,NULL,params[1],params[2]));
@@ -817,6 +819,7 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string>
TreeServer* Node = new TreeServer(this->Utils,this->Instance,servername,description,ParentOfThis,NULL, lnk ? lnk->Hidden : false);
ParentOfThis->AddChild(Node);
params[3] = ":" + params[3];
+ Utils->SetRemoteBursting(Node, true);
Utils->DoOneToAllButSender(prefix,"SERVER",params,prefix);
this->Instance->SNO->WriteToSnoMask('l',"Server \002"+prefix+"\002 introduced server \002"+servername+"\002 ("+description+")");
return true;
@@ -1186,6 +1189,9 @@ bool TreeSocket::ProcessLine(std::string &line)
}
else if (command == "FJOIN")
{
+ TreeServer* ServerSource = Utils->FindServer(prefix);
+ if (ServerSource)
+ Utils->SetRemoteBursting(ServerSource, false);
return this->ForceJoin(prefix,params);
}
else if (command == "STATS")
@@ -1218,6 +1224,9 @@ bool TreeSocket::ProcessLine(std::string &line)
}
else if (command == "FMODE")
{
+ TreeServer* ServerSource = Utils->FindServer(prefix);
+ if (ServerSource)
+ Utils->SetRemoteBursting(ServerSource, false);
return this->ForceMode(prefix,params);
}
else if (command == "KILL")
@@ -1247,6 +1256,10 @@ bool TreeSocket::ProcessLine(std::string &line)
* This can't be right, so set them to not bursting, and
* apply their lines.
*/
+ TreeServer* ServerSource = Utils->FindServer(prefix);
+ if (ServerSource)
+ Utils->SetRemoteBursting(ServerSource, false);
+
if (this->bursting)
{
this->bursting = false;
@@ -1266,6 +1279,10 @@ bool TreeSocket::ProcessLine(std::string &line)
* This can't be right, so set them to not bursting, and
* apply their lines.
*/
+ TreeServer* ServerSource = Utils->FindServer(prefix);
+ if (ServerSource)
+ Utils->SetRemoteBursting(ServerSource, false);
+
if (this->bursting)
{
this->bursting = false;
@@ -1292,6 +1309,9 @@ bool TreeSocket::ProcessLine(std::string &line)
}
else if (command == "ADDLINE")
{
+ TreeServer* ServerSource = Utils->FindServer(prefix);
+ if (ServerSource)
+ Utils->SetRemoteBursting(ServerSource, false);
return this->AddLine(prefix,params);
}
else if (command == "SVSNICK")
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index b3394dd55..a27dd5f65 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -53,6 +53,16 @@ TreeServer* SpanningTreeUtilities::FindServer(const std::string &ServerName)
}
}
+TreeServer* SpanningTreeUtilities::FindRemoteBurstServer(TreeServer* Server)
+{
+ server_hash::iterator iter;
+ iter = RemoteServersBursting.find(Server->GetName().c_str());
+ if (iter != RemoteServersBursting.end())
+ return iter->second;
+ else
+ return NULL;
+}
+
TreeSocket* SpanningTreeUtilities::FindBurstingServer(const std::string &ServerName)
{
std::map<irc::string,TreeSocket*>::iterator iter;
@@ -67,6 +77,23 @@ TreeSocket* SpanningTreeUtilities::FindBurstingServer(const std::string &ServerN
}
}
+void SpanningTreeUtilities::SetRemoteBursting(TreeServer* Server, bool bursting)
+{
+ ServerInstance->Log(DEBUG,"Server %s is %sbursting nicknames", Server->GetName().c_str(), bursting ? "" : "no longer ");
+ server_hash::iterator iter;
+ iter = RemoteServersBursting.find(Server->GetName().c_str());
+ if (bursting)
+ {
+ if (iter == RemoteServersBursting.end())
+ RemoteServersBursting.erase(iter);
+ }
+ else
+ {
+ if (iter != RemoteServersBursting.end())
+ RemoteServersBursting.insert(make_pair(Server->GetName(), Server));
+ }
+}
+
void SpanningTreeUtilities::AddBurstingServer(const std::string &ServerName, TreeSocket* s)
{
std::map<irc::string,TreeSocket*>::iterator iter;
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 0e289146b..f9f61acaf 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -51,6 +51,9 @@ class SpanningTreeUtilities
/** Creator module
*/
ModuleSpanningTree* Creator;
+ /** Remote servers that are currently bursting
+ */
+ server_hash RemoteServersBursting;
/** Flatten links and /MAP for non-opers
*/
bool FlatLinks;
@@ -148,6 +151,12 @@ class SpanningTreeUtilities
/** Find a server by name
*/
TreeServer* FindServer(const std::string &ServerName);
+ /** Find a remote bursting server by name
+ */
+ TreeServer* FindRemoteBurstServer(TreeServer* Server);
+ /** Set a remote server to bursting or not bursting
+ */
+ void SetRemoteBursting(TreeServer* Server, bool bursting);
/** Find a route to a server by name
*/
TreeServer* BestRouteTo(const std::string &ServerName);