summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/xline.h8
-rw-r--r--src/InspIRCd.layout44
-rw-r--r--src/commands.cpp2
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/message.cpp8
-rw-r--r--src/xline.cpp58
6 files changed, 92 insertions, 30 deletions
diff --git a/include/xline.h b/include/xline.h
index bdd9ac2d3..15de2113d 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -72,6 +72,7 @@ class ZLine : public XLine
* May contain wildcards.
*/
char ipaddr[MAXBUF];
+ bool is_global;
};
/** QLine class
@@ -83,6 +84,7 @@ class QLine : public XLine
* May contain wildcards.
*/
char nick[MAXBUF];
+ bool is_global;
};
void read_xline_defaults();
@@ -114,5 +116,11 @@ void gline_set_creation_time(char* host, time_t create_time);
void qline_set_creation_time(char* nick, time_t create_time);
void zline_set_creation_time(char* ip, time_t create_time);
+bool zline_make_global(char* ipaddr);
+bool qline_make_global(char* nickname);
+
+void sync_xlines(serverrec* serv, char* tcp_host);
+
#endif
+
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 7149e45a4..741140b89 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -1,5 +1,5 @@
[Editors]
-Focused=42
+Focused=46
Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0
[Editor_0]
@@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=0
-CursorCol=31
-CursorRow=2154
-TopLine=2110
+CursorCol=1
+CursorRow=2924
+TopLine=2877
LeftChar=1
[Editor_2]
@@ -37,7 +37,7 @@ LeftChar=1
[Editor_4]
Open=1
Top=0
-CursorCol=58
+CursorCol=1
CursorRow=163
TopLine=135
LeftChar=1
@@ -99,11 +99,11 @@ TopLine=1
LeftChar=1
[Editor_12]
-Open=0
+Open=1
Top=0
CursorCol=12
CursorRow=104
-TopLine=1
+TopLine=104
LeftChar=1
[Editor_13]
@@ -302,8 +302,8 @@ LeftChar=1
[Editor_39]
Open=1
Top=0
-CursorCol=16
-CursorRow=263
+CursorCol=1
+CursorRow=237
TopLine=220
LeftChar=1
[Editor_40]
@@ -322,17 +322,17 @@ TopLine=1
LeftChar=1
[Editor_42]
Open=1
-Top=1
-CursorCol=33
-CursorRow=660
+Top=0
+CursorCol=30
+CursorRow=662
TopLine=618
LeftChar=1
[Editor_43]
Open=1
Top=0
-CursorCol=1
-CursorRow=2083
-TopLine=2066
+CursorCol=9
+CursorRow=2333
+TopLine=2290
LeftChar=1
[Editor_44]
Open=1
@@ -344,14 +344,14 @@ LeftChar=1
[Editor_45]
Open=1
Top=0
-CursorCol=60
-CursorRow=115
-TopLine=61
+CursorCol=1
+CursorRow=124
+TopLine=3
LeftChar=1
[Editor_46]
Open=1
-Top=0
-CursorCol=24
-CursorRow=380
-TopLine=344
+Top=1
+CursorCol=30
+CursorRow=339
+TopLine=297
LeftChar=1
diff --git a/src/commands.cpp b/src/commands.cpp
index 8d3e087bd..69fea5ec5 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -2085,6 +2085,7 @@ void handle_add_sqline(char token,char* params,serverrec* source,serverrec* repl
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
qline_set_creation_time(mask,atoi(create_time));
+ qline_make_global(mask);
if (!atoi(duration))
{
WriteOpers("*** %s Added permenant Q-Line on %s.",who,mask);
@@ -2126,6 +2127,7 @@ void handle_add_szline(char token,char* params,serverrec* source,serverrec* repl
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
zline_set_creation_time(mask,atoi(create_time));
+ zline_make_global(mask);
if (!atoi(duration))
{
WriteOpers("*** %s Added permenant Z-Line on %s.",who,mask);
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 8f0958890..e7afdb5ff 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2922,6 +2922,8 @@ void DoSync(serverrec* serv, char* tcp_host)
serv->SendPacket(data,tcp_host);
}
}
+ // sync global zlines, glines, etc
+ sync_xlines(serv,tcp_host);
snprintf(data,MAXBUF,"F %d",time(NULL));
serv->SendPacket(data,tcp_host);
log(DEBUG,"Sent sync");
diff --git a/src/message.cpp b/src/message.cpp
index e71e72a48..41f919be9 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -234,14 +234,6 @@ bool hasumode(userrec* user, char mode)
void ChangeName(userrec* user, const char* gecos)
{
strncpy(user->fullname,gecos,MAXBUF);
-
- // TODO: replace these with functions:
- // NetSendToAll - to all
- // NetSendToCommon - to all that hold users sharing a common channel with another user
- // NetSendToOne - to one server
- // NetSendToAllExcept - send to all but one
- // all by servername
-
char buffer[MAXBUF];
snprintf(buffer,MAXBUF,"a %s :%s",user->nick,gecos);
NetSendToAll(buffer);
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)