summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xline.h10
-rw-r--r--src/modules/m_spanningtree.cpp21
-rw-r--r--src/xline.cpp25
3 files changed, 34 insertions, 22 deletions
diff --git a/include/xline.h b/include/xline.h
index 65095b1c5..7fd02e6ac 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -125,11 +125,11 @@ class QLine : public XLine
void read_xline_defaults();
-void add_gline(long duration, const char* source, const char* reason, const char* hostmask);
-void add_qline(long duration, const char* source, const char* reason, const char* nickname);
-void add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
-void add_kline(long duration, const char* source, const char* reason, const char* hostmask);
-void add_eline(long duration, const char* source, const char* reason, const char* hostmask);
+bool add_gline(long duration, const char* source, const char* reason, const char* hostmask);
+bool add_qline(long duration, const char* source, const char* reason, const char* nickname);
+bool add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
+bool add_kline(long duration, const char* source, const char* reason, const char* hostmask);
+bool add_eline(long duration, const char* source, const char* reason, const char* hostmask);
bool del_gline(const char* hostmask);
bool del_qline(const char* nickname);
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index e1dbb5291..2aadd97f0 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1554,35 +1554,42 @@ class TreeSocket : public InspSocket
if (params.size() < 6)
return true;
+ bool propogate = false;
+
switch (*(params[0].c_str()))
{
case 'Z':
- add_zline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ propogate = add_zline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
zline_set_creation_time((char*)params[1].c_str(), atoi(params[3].c_str()));
break;
case 'Q':
- add_qline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ propogate = add_qline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
qline_set_creation_time((char*)params[1].c_str(), atoi(params[3].c_str()));
break;
case 'E':
- add_eline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ propogate = add_eline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
eline_set_creation_time((char*)params[1].c_str(), atoi(params[3].c_str()));
break;
case 'G':
- add_gline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ propogate = add_gline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
gline_set_creation_time((char*)params[1].c_str(), atoi(params[3].c_str()));
break;
case 'K':
- add_kline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ propogate = add_kline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ kline_set_creation_time((char*)params[1].c_str(), atoi(params[3].c_str()));
break;
default:
/* Just in case... */
Srv->SendOpers("*** \2WARNING\2: Invalid xline type '"+params[0]+"' sent by server "+prefix+", ignored!");
+ propogate = false;
break;
}
/* Send it on its way */
- params[5] = ":" + params[5];
- DoOneToAllButSender(prefix,"ADDLINE",params,prefix);
+ if (propogate)
+ {
+ params[5] = ":" + params[5];
+ DoOneToAllButSender(prefix,"ADDLINE",params,prefix);
+ }
return true;
}
diff --git a/src/xline.cpp b/src/xline.cpp
index bfffd0d84..97b28c24d 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -148,9 +148,9 @@ void read_xline_defaults()
// adds a g:line
-void add_gline(long duration, const char* source,const char* reason,const char* hostmask)
+bool add_gline(long duration, const char* source,const char* reason,const char* hostmask)
{
- del_gline(hostmask);
+ bool ret = del_gline(hostmask);
GLine item;
item.duration = duration;
strlcpy(item.hostmask,hostmask,199);
@@ -167,13 +167,14 @@ void add_gline(long duration, const char* source,const char* reason,const char*
{
pglines.push_back(item);
}
+ return !ret;
}
// adds an e:line (exception to bans)
-void add_eline(long duration, const char* source, const char* reason, const char* hostmask)
+bool add_eline(long duration, const char* source, const char* reason, const char* hostmask)
{
- del_eline(hostmask);
+ bool ret = del_eline(hostmask);
ELine item;
item.duration = duration;
strlcpy(item.hostmask,hostmask,199);
@@ -190,13 +191,14 @@ void add_eline(long duration, const char* source, const char* reason, const char
{
pelines.push_back(item);
}
+ return !ret;
}
// adds a q:line
-void add_qline(long duration, const char* source, const char* reason, const char* nickname)
+bool add_qline(long duration, const char* source, const char* reason, const char* nickname)
{
- del_qline(nickname);
+ bool ret = del_qline(nickname);
QLine item;
item.duration = duration;
strlcpy(item.nick,nickname,63);
@@ -214,13 +216,14 @@ void add_qline(long duration, const char* source, const char* reason, const char
{
pqlines.push_back(item);
}
+ return !ret;
}
// adds a z:line
-void add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
+bool add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
{
- del_zline(ipaddr);
+ bool ret = del_zline(ipaddr);
ZLine item;
item.duration = duration;
if (strchr(ipaddr,'@'))
@@ -244,13 +247,14 @@ void add_zline(long duration, const char* source, const char* reason, const char
{
pzlines.push_back(item);
}
+ return !ret;
}
// adds a k:line
-void add_kline(long duration, const char* source, const char* reason, const char* hostmask)
+bool add_kline(long duration, const char* source, const char* reason, const char* hostmask)
{
- del_kline(hostmask);
+ bool ret = del_kline(hostmask);
KLine item;
item.duration = duration;
strlcpy(item.hostmask,hostmask,200);
@@ -267,6 +271,7 @@ void add_kline(long duration, const char* source, const char* reason, const char
{
pklines.push_back(item);
}
+ return !ret;
}
// deletes a g:line, returns true if the line existed and was removed