summaryrefslogtreecommitdiff
path: root/src/modules/m_rline.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2012-06-26 14:16:44 -0700
committerAttila Molnar <attilamolnar@hush.com>2012-06-26 14:16:44 -0700
commit9539fa9d7bcb19100bd5b7f67d6f792e48fff909 (patch)
tree998a501a9d176eb9f3bebe484ebeaaaf6f67e3b8 /src/modules/m_rline.cpp
parentf293861ab70eab76ae0715a5f2c2769de332c779 (diff)
parent14b7e4c1ab7fd7d9cf71344bb08b211a0aa1ca15 (diff)
Merge pull request #215 from attilamolnar/insp20+modfixes
[2.0] Bugfixes/improvements in m_rline, m_svshold, m_shun, m_cban
Diffstat (limited to 'src/modules/m_rline.cpp')
-rw-r--r--src/modules/m_rline.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 06c852938..28fa891b6 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -27,7 +27,7 @@
#include "xline.h"
static bool ZlineOnMatch = false;
-static std::vector<ZLine *> background_zlines;
+static bool added_zline = false;
class RLine : public XLine
{
@@ -75,8 +75,17 @@ class RLine : public XLine
void Apply(User* u)
{
- if (ZlineOnMatch) {
- background_zlines.push_back(new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName.c_str(), reason.c_str(), u->GetIPString()));
+ if (ZlineOnMatch)
+ {
+ ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName.c_str(), reason.c_str(), u->GetIPString());
+ if (ServerInstance->XLines->AddLine(zl, NULL))
+ {
+ ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on *@%s%s%s: %s",
+ zl->ipaddr.c_str(), zl->duration ? " to expire on " : "", zl->duration ? ServerInstance->TimeString(zl->expiry).c_str() : "", zl->reason.c_str());
+ added_zline = true;
+ }
+ else
+ delete zl;
}
DefaultApply(u, "R", false);
}
@@ -199,7 +208,7 @@ class CommandRLine : public Command
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
{
- return ROUTE_BROADCAST;
+ return ROUTE_LOCALONLY;
}
};
@@ -254,9 +263,6 @@ class ModuleRLine : public Module
{
ConfigReader Conf;
- if (!Conf.ReadFlag("rline", "zlineonmatch", 0) && ZlineOnMatch)
- background_zlines.clear();
-
MatchOnNickChange = Conf.ReadFlag("rline", "matchonnickchange", 0);
ZlineOnMatch = Conf.ReadFlag("rline", "zlineonmatch", 0);
std::string newrxengine = Conf.ReadValue("rline", "engine", 0);
@@ -299,18 +305,11 @@ class ModuleRLine : public Module
virtual void OnBackgroundTimer(time_t curtime)
{
- if (!ZlineOnMatch) return;
- for (std::vector<ZLine *>::iterator i = background_zlines.begin(); i != background_zlines.end(); i++)
+ if (added_zline)
{
- ZLine *zl = *i;
- if (ServerInstance->XLines->AddLine(zl,NULL))
- {
- ServerInstance->SNO->WriteToSnoMask('x',"Z-line added due to R-line match on *@%s%s%s: %s",
- zl->ipaddr.c_str(), zl->duration ? " to expire on " : "", zl->duration ? ServerInstance->TimeString(zl->expiry).c_str() : "", zl->reason.c_str());
- ServerInstance->XLines->ApplyLines();
- }
+ added_zline = false;
+ ServerInstance->XLines->ApplyLines();
}
- background_zlines.clear();
}
};