summaryrefslogtreecommitdiff
path: root/src/xline.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-25 13:54:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-25 13:54:16 +0000
commit098f4bdc41d230b20e243e7d3efc92b8b54c975d (patch)
treee3e7d4684db79798eb7e850ad78d84b481d5b79c /src/xline.cpp
parent4085f5dedc915399760ed14a6a9b404509aecf44 (diff)
Added some stuff to diffrentiate between global and local Q/Z lines
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@724 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/xline.cpp')
-rw-r--r--src/xline.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index 152ca6e82..b87e236a3 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -227,6 +227,7 @@ void add_qline(long duration, char* source, char* reason, char* nickname)
strncpy(item.reason,reason,MAXBUF);
strncpy(item.source,source,MAXBUF);
item.n_matches = 0;
+ item.is_global = false;
item.set_time = time(NULL);
qlines.push_back(item);
}
@@ -242,6 +243,7 @@ void add_zline(long duration, char* source, char* reason, char* ipaddr)
strncpy(item.reason,reason,MAXBUF);
strncpy(item.source,source,MAXBUF);
item.n_matches = 0;
+ item.is_global = false;
item.set_time = time(NULL);
zlines.push_back(item);
}
@@ -291,6 +293,62 @@ bool del_qline(char* nickname)
return false;
}
+bool qline_make_global(char* nickname)
+{
+ for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
+ {
+ if (!strcasecmp(nickname,i->nick))
+ {
+ i->is_global = true;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool zline_make_global(char* ipaddr)
+{
+ for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
+ {
+ if (!strcasecmp(ipaddr,i->ipaddr))
+ {
+ i->is_global = true;
+ return true;
+ }
+ }
+ return false;
+}
+
+void sync_xlines(serverrec* serv, char* tcp_host)
+{
+ char data[MAXBUF];
+
+ // for zlines and qlines, we should first check if theyre global...
+ for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
+ {
+ if (i->is_global)
+ {
+ snprintf(netdata,MAXBUF,"} %s %s %ld %ld :%s",i->ipaddr,i->source,i->set_time,i->duration,i->reason);
+ serv->SendPacket(data,tcp_host);
+ }
+ }
+ for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
+ {
+ if (i->is_global)
+ {
+ snprintf(netdata,MAXBUF,"{ %s %s %ld %ld :%s",i->ipaddr,i->source,i->set_time,i->duration,i->reason);
+ serv->SendPacket(data,tcp_host);
+ }
+ }
+ // glines are always global, so no need to check
+ for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
+ {
+ snprintf(netdata,MAXBUF,"# %s %s %ld %ld :%s",i->ipaddr,i->source,i->set_time,i->duration,i->reason);
+ serv->SendPacket(data,tcp_host);
+ }
+}
+
+
// deletes a z:line, returns true if the line existed and was removed
bool del_zline(char* ipaddr)