summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-28 18:33:06 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-28 18:33:06 +0000
commit4840d5e77572f42b710501912d59b5dbb6d2c2af (patch)
tree6ff11fbb04dd9a78ae9befdc66bcdb4ea03aa2a4 /src/modules
parentf35e50f35c0174973802721dc6aef980e2eb8196 (diff)
- Tear out a useless load of XLine clutters that did nothing much except confuse things
- Revert back to early 1.0 design of using a single list for line storage. We'll make this work more efficiently than 1.0 though of course. This simplifies the code for expiry, checking, etc. - Merge a bunch of sort callbacks into a single sort callback for class XLine. - Horribly break apply_lines() for the time being. .. and that's probably it. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8398 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_antibear.cpp11
-rw-r--r--src/modules/m_dnsbl.cpp6
-rw-r--r--src/modules/m_filter.h4
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp20
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp26
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.h5
7 files changed, 18 insertions, 56 deletions
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp
index 5690572ce..3fced6079 100644
--- a/src/modules/m_antibear.cpp
+++ b/src/modules/m_antibear.cpp
@@ -46,12 +46,11 @@ class ModuleAntiBear : public Module
{
if (!strncmp(parameters[1], "\1TIME Mon May 01 18:54:20 2006", 30))
{
- if (ServerInstance->XLines->add_zline(86400, ServerInstance->Config->ServerName, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->MakeHostIP()))
- {
- ServerInstance->XLines->apply_lines(APPLY_ZLINES);
- FOREACH_MOD(I_OnAddGLine,OnAddZLine(86400, NULL, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->MakeHostIP()));
- return 1;
- }
+ ServerInstance->XLines->add_zline(86400, ServerInstance->Config->ServerName, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->GetIPString());
+ // XXX move events into the damn XLineManager stuff
+ FOREACH_MOD(I_OnAddGLine,OnAddZLine(86400, NULL, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->MakeHostIP()));
+ ServerInstance->XLines->apply_lines();
+ return 1;
}
user->Shrink("antibear_timewait");
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index c92a2c111..1d99943d5 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -115,7 +115,7 @@ class DNSBLResolver : public Resolver
{
std::string ban = std::string("*@") + them->GetIPString();
if (show)
- ServerInstance->XLines->apply_lines(APPLY_KLINES);
+ ServerInstance->XLines->apply_lines();
show = ServerInstance->XLines->add_kline(ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), ban.c_str());
FOREACH_MOD(I_OnAddKLine,OnAddKLine(ConfEntry->duration, NULL, reason, ban));
break;
@@ -125,7 +125,7 @@ class DNSBLResolver : public Resolver
std::string ban = std::string("*@") + them->GetIPString();
show = ServerInstance->XLines->add_gline(ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), ban.c_str());
if (show)
- ServerInstance->XLines->apply_lines(APPLY_GLINES);
+ ServerInstance->XLines->apply_lines();
FOREACH_MOD(I_OnAddGLine,OnAddGLine(ConfEntry->duration, NULL, reason, ban));
break;
}
@@ -133,7 +133,7 @@ class DNSBLResolver : public Resolver
{
show = ServerInstance->XLines->add_zline(ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), them->GetIPString());
if (show)
- ServerInstance->XLines->apply_lines(APPLY_ZLINES);
+ ServerInstance->XLines->apply_lines();
FOREACH_MOD(I_OnAddZLine,OnAddZLine(ConfEntry->duration, NULL, reason, them->GetIPString()));
break;
}
diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h
index 0f1dc97bd..f88657ee8 100644
--- a/src/modules/m_filter.h
+++ b/src/modules/m_filter.h
@@ -282,7 +282,7 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri
{
if (ServerInstance->XLines->add_gline(f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), user->MakeHostIP()))
{
- ServerInstance->XLines->apply_lines(APPLY_GLINES);
+ ServerInstance->XLines->apply_lines();
FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP()));
}
}
@@ -370,7 +370,7 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters
if (ServerInstance->XLines->add_gline(f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), wild.c_str()))
{
- ServerInstance->XLines->apply_lines(APPLY_GLINES);
+ ServerInstance->XLines->apply_lines();
FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP()));
}
}
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index d9d44733d..5b79e1aee 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -1238,26 +1238,6 @@ void TreeSocket::SendXLines(TreeServer* Current)
snprintf(data,MAXBUF,":%s ADDLINE E %s@%s %s %lu %lu :%s\r\n",sn,(*i)->identmask,(*i)->hostmask,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
buffer.append(data);
}
- for (std::vector<ZLine*>::iterator i = Instance->XLines->pzlines.begin(); i != Instance->XLines->pzlines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE Z %s %s %lu %lu :%s\r\n",sn,(*i)->ipaddr,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
- for (std::vector<QLine*>::iterator i = Instance->XLines->pqlines.begin(); i != Instance->XLines->pqlines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE Q %s %s %lu %lu :%s\r\n",sn,(*i)->nick,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
- for (std::vector<GLine*>::iterator i = Instance->XLines->pglines.begin(); i != Instance->XLines->pglines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE G %s@%s %s %lu %lu :%s\r\n",sn,(*i)->identmask,(*i)->hostmask,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
- for (std::vector<ELine*>::iterator i = Instance->XLines->pelines.begin(); i != Instance->XLines->pelines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE E %s@%s %s %lu %lu :%s\r\n",sn,(*i)->identmask,(*i)->hostmask,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
if (!buffer.empty())
this->WriteLine(buffer);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 01e1316f5..d8eab8a5e 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -522,22 +522,18 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
{
if (params.size() < 6)
return true;
+
bool propogate = false;
- if (!this->bursting)
- Utils->lines_to_apply = 0;
+
switch (*(params[0].c_str()))
{
case 'Z':
propogate = Instance->XLines->add_zline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
Instance->XLines->zline_set_creation_time(params[1].c_str(), atoi(params[3].c_str()));
- if (propogate)
- Utils->lines_to_apply |= APPLY_ZLINES;
break;
case 'Q':
propogate = Instance->XLines->add_qline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
Instance->XLines->qline_set_creation_time(params[1].c_str(), atoi(params[3].c_str()));
- if (propogate)
- Utils->lines_to_apply |= APPLY_QLINES;
break;
case 'E':
propogate = Instance->XLines->add_eline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
@@ -546,13 +542,9 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
case 'G':
propogate = Instance->XLines->add_gline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
Instance->XLines->gline_set_creation_time(params[1].c_str(), atoi(params[3].c_str()));
- if (propogate)
- Utils->lines_to_apply |= APPLY_GLINES;
break;
case 'K':
propogate = Instance->XLines->add_kline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
- if (propogate)
- Utils->lines_to_apply |= APPLY_KLINES;
break;
default:
/* Just in case... */
@@ -575,11 +567,12 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
params[5] = ":" + params[5];
Utils->DoOneToAllButSender(prefix,"ADDLINE",params,prefix);
}
+
if (!this->bursting)
{
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
}
+
return true;
}
@@ -1347,8 +1340,7 @@ bool TreeSocket::ProcessLine(std::string &line)
if (this->bursting)
{
this->bursting = false;
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
}
return this->LocalPing(prefix,params);
@@ -1367,8 +1359,7 @@ bool TreeSocket::ProcessLine(std::string &line)
if (this->bursting)
{
this->bursting = false;
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
}
return this->LocalPong(prefix,params);
@@ -1486,8 +1477,7 @@ bool TreeSocket::ProcessLine(std::string &line)
else if (command == "ENDBURST")
{
this->bursting = false;
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
std::string sourceserv = this->myhost;
if (!this->InboundServerName.empty())
sourceserv = this->InboundServerName;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 0376ea0c2..f147a6f79 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -177,8 +177,6 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT
{
Bindings.clear();
- lines_to_apply = 0;
-
this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID());
modulelist* ml = ServerInstance->Modules->FindInterface("BufferedSocketHook");
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 38ddba0ed..d437b998b 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -94,11 +94,6 @@ class SpanningTreeUtilities
/** Holds the data from the <link> tags in the conf
*/
std::vector<Link> LinkBlocks;
- /** Holds a bitmask of queued xline types waiting to be applied.
- * Will be a mask containing values APPLY_GLINES, APPLY_KLINES,
- * APPLY_QLINES and APPLY_ZLINES.
- */
- int lines_to_apply;
/** If this is true, this server is the master sync server for time
* synching - e.g. it is the server with its clock correct. It will