summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-14 17:03:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-14 17:03:16 +0000
commit18e822f8bb02f66b64e1d3f183d4779a745f8eca (patch)
treec160795e35e14527c82291e48ca9c9ee0f495296 /src
parent97a4acebb53a9c07e988a9ae1311d95adb5806eb (diff)
Fix for bug #324 reported by HiroP
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7303 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_eline.cpp4
-rw-r--r--src/cmd_kline.cpp4
-rw-r--r--src/cmd_qline.cpp4
-rw-r--r--src/cmd_zline.cpp4
-rw-r--r--src/xline.cpp108
5 files changed, 88 insertions, 36 deletions
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index be78e3b35..981a10f32 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -54,6 +54,10 @@ CmdResult cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
ServerInstance->TimeString(c_requires_crap).c_str());
}
}
+ else
+ {
+ user->WriteServ("NOTICE %s :*** E-Line for %s already exists",user->nick,parameters[0]);
+ }
}
else
{
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index eab027b70..90ddca55c 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -64,6 +64,10 @@ CmdResult cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
ServerInstance->XLines->apply_lines(to_apply);
}
+ else
+ {
+ user->WriteServ("NOTICE %s :*** K-Line for %s already exists",user->nick,parameters[0]);
+ }
}
else
{
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index 383f27756..bb1122854 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -56,6 +56,10 @@ CmdResult cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
}
ServerInstance->XLines->apply_lines(to_apply);
}
+ else
+ {
+ user->WriteServ("NOTICE %s :*** Q-Line for %s already exists",user->nick,parameters[0]);
+ }
}
else
{
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 443647208..8fea70656 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -57,6 +57,10 @@ CmdResult cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
}
ServerInstance->XLines->apply_lines(to_apply);
}
+ else
+ {
+ user->WriteServ("NOTICE %s :*** Z-Line for %s already exists",user->nick,parameters[0]);
+ }
}
else
{
diff --git a/src/xline.cpp b/src/xline.cpp
index 7a1b4a8aa..9b05a57f8 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -127,7 +127,8 @@ bool XLineManager::add_gline(long duration, const char* source,const char* reaso
{
IdentHostPair ih = IdentSplit(hostmask);
- bool ret = del_gline(hostmask);
+ if (del_gline(hostmask, true))
+ return false;
GLine* item = new GLine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
@@ -141,7 +142,7 @@ bool XLineManager::add_gline(long duration, const char* source,const char* reaso
pglines.push_back(item);
}
- return !ret;
+ return true;
}
// adds an e:line (exception to bans)
@@ -150,7 +151,8 @@ bool XLineManager::add_eline(long duration, const char* source, const char* reas
{
IdentHostPair ih = IdentSplit(hostmask);
- bool ret = del_eline(hostmask);
+ if (del_eline(hostmask, true))
+ return false;
ELine* item = new ELine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
@@ -163,14 +165,16 @@ bool XLineManager::add_eline(long duration, const char* source, const char* reas
{
pelines.push_back(item);
}
- return !ret;
+ return true;
}
// adds a q:line
bool XLineManager::add_qline(long duration, const char* source, const char* reason, const char* nickname)
{
- bool ret = del_qline(nickname);
+ if (del_qline(nickname, true))
+ return false;
+
QLine* item = new QLine(ServerInstance->Time(), duration, source, reason, nickname);
if (duration)
@@ -182,15 +186,13 @@ bool XLineManager::add_qline(long duration, const char* source, const char* reas
{
pqlines.push_back(item);
}
- return !ret;
+ return true;
}
// adds a z:line
bool XLineManager::add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
{
- bool ret = del_zline(ipaddr);
-
if (strchr(ipaddr,'@'))
{
while (*ipaddr != '@')
@@ -198,6 +200,9 @@ bool XLineManager::add_zline(long duration, const char* source, const char* reas
ipaddr++;
}
+ if (del_zline(ipaddr, true))
+ return false;
+
ZLine* item = new ZLine(ServerInstance->Time(), duration, source, reason, ipaddr);
if (duration)
@@ -209,7 +214,7 @@ bool XLineManager::add_zline(long duration, const char* source, const char* reas
{
pzlines.push_back(item);
}
- return !ret;
+ return true;
}
// adds a k:line
@@ -218,7 +223,8 @@ bool XLineManager::add_kline(long duration, const char* source, const char* reas
{
IdentHostPair ih = IdentSplit(hostmask);
- bool ret = del_kline(hostmask);
+ if (del_kline(hostmask, true))
+ return false;
KLine* item = new KLine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
@@ -231,20 +237,23 @@ bool XLineManager::add_kline(long duration, const char* source, const char* reas
{
pklines.push_back(item);
}
- return !ret;
+ return true;
}
// deletes a g:line, returns true if the line existed and was removed
-bool XLineManager::del_gline(const char* hostmask)
+bool XLineManager::del_gline(const char* hostmask, bool simulate)
{
IdentHostPair ih = IdentSplit(hostmask);
for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
{
if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
{
- delete *i;
- glines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ glines.erase(i);
+ }
return true;
}
}
@@ -252,8 +261,11 @@ bool XLineManager::del_gline(const char* hostmask)
{
if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
{
- delete *i;
- pglines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ pglines.erase(i);
+ }
return true;
}
}
@@ -262,15 +274,18 @@ bool XLineManager::del_gline(const char* hostmask)
// deletes a e:line, returns true if the line existed and was removed
-bool XLineManager::del_eline(const char* hostmask)
+bool XLineManager::del_eline(const char* hostmask, bool simulate)
{
IdentHostPair ih = IdentSplit(hostmask);
for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
{
if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
{
- delete *i;
- elines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ elines.erase(i);
+ }
return true;
}
}
@@ -278,8 +293,11 @@ bool XLineManager::del_eline(const char* hostmask)
{
if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
{
- delete *i;
- pelines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ pelines.erase(i);
+ }
return true;
}
}
@@ -288,14 +306,17 @@ bool XLineManager::del_eline(const char* hostmask)
// deletes a q:line, returns true if the line existed and was removed
-bool XLineManager::del_qline(const char* nickname)
+bool XLineManager::del_qline(const char* nickname, bool simulate)
{
for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
{
if (!strcasecmp(nickname,(*i)->nick))
{
- delete *i;
- qlines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ qlines.erase(i);
+ }
return true;
}
}
@@ -303,8 +324,11 @@ bool XLineManager::del_qline(const char* nickname)
{
if (!strcasecmp(nickname,(*i)->nick))
{
- delete *i;
- pqlines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ pqlines.erase(i);
+ }
return true;
}
}
@@ -313,14 +337,17 @@ bool XLineManager::del_qline(const char* nickname)
// deletes a z:line, returns true if the line existed and was removed
-bool XLineManager::del_zline(const char* ipaddr)
+bool XLineManager::del_zline(const char* ipaddr, bool simulate)
{
for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
{
if (!strcasecmp(ipaddr,(*i)->ipaddr))
{
- delete *i;
- zlines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ zlines.erase(i);
+ }
return true;
}
}
@@ -328,8 +355,11 @@ bool XLineManager::del_zline(const char* ipaddr)
{
if (!strcasecmp(ipaddr,(*i)->ipaddr))
{
- delete *i;
- pzlines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ pzlines.erase(i);
+ }
return true;
}
}
@@ -338,15 +368,18 @@ bool XLineManager::del_zline(const char* ipaddr)
// deletes a k:line, returns true if the line existed and was removed
-bool XLineManager::del_kline(const char* hostmask)
+bool XLineManager::del_kline(const char* hostmask, bool simulate)
{
IdentHostPair ih = IdentSplit(hostmask);
for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++)
{
if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
{
- delete *i;
- klines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ klines.erase(i);
+ }
return true;
}
}
@@ -354,8 +387,11 @@ bool XLineManager::del_kline(const char* hostmask)
{
if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
{
- delete *i;
- pklines.erase(i);
+ if (!simulate)
+ {
+ delete *i;
+ pklines.erase(i);
+ }
return true;
}
}