From c215eff073c70368ba25e1784103e5c9fbc7f935 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 28 Feb 2006 19:33:42 +0000 Subject: BanHiding git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3384 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd_io.h | 5 +++++ src/helperfuncs.cpp | 25 ++++++++++++++++--------- src/inspircd_io.cpp | 9 ++++----- src/svn-rev.sh | 2 +- src/xline.cpp | 2 +- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/include/inspircd_io.h b/include/inspircd_io.h index 711488c36..6ddb9983e 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -228,6 +228,11 @@ class ServerConfig : public classbase */ bool HideSplits; + /** True if we're going to hide ban reasons for non-opers (e.g. G-Lines, + * K-Lines, Z-Lines) + */ + bool HideBans; + /** Set to a non-empty string to obfuscate the server name of users in WHOIS */ char HideWhoisServer[MAXBUF]; diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 14455ed9b..eed073a35 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -748,12 +748,26 @@ void WriteCommonExcept(userrec *u, char* text, ...) split >> server_two; if ((FindServerName(server_one)) && (FindServerName(server_two))) { - strlcpy(oper_quit,textbuffer,MAXBUF); + strlcpy(oper_quit,textbuffer,MAXQUIT); strlcpy(check,"*.net *.split",MAXQUIT); quit_munge = true; } } } + if ((Config->HideBans) && (total > 13) && (!quit_munge)) + { + char* check = textbuffer; + if ((*check++ == 'Q') && (*check++ == 'U') && (*check++ == 'I') && (*check++ == 'T') && (*check++ == ' ') && (*check++ == ':')) + { + check++; + if ((*check++ == '-') && (*check++ == 'L') && (*check++ == 'i') && (*check++ == 'n') && (*check++ == 'e') && (*check++ == 'd') && (*check++ == ':')) + { + strlcpy(oper_quit,textbuffer,MAXQUIT); + *(--check) = 0; // We don't need to strlcpy, we just chop it from the : + quit_munge = true; + } + } + } memset(&already_sent,0,MAX_DESCRIPTORS); @@ -774,14 +788,7 @@ void WriteCommonExcept(userrec *u, char* text, ...) already_sent[otheruser->fd] = 1; if (quit_munge) { - if (*otheruser->oper) - { - WriteFrom_NoFormat(otheruser->fd,u,oper_quit); - } - else - { - WriteFrom_NoFormat(otheruser->fd,u,textbuffer); - } + WriteFrom_NoFormat(otheruser->fd,u,*otheruser->oper ? oper_quit : textbuffer); } else WriteFrom_NoFormat(otheruser->fd,u,textbuffer); } diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index a78666afe..10ac023f4 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -49,11 +49,9 @@ ServerConfig::ServerConfig() *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0'; *OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0'; log_file = NULL; - nofork = false; - unlimitcore = false; + nofork = HideBans = HideSplits = unlimitcore = false; AllowHalfop = true; - HideSplits = false; - dns_timeout = 5; + dns_timeout = DieDelay = 5; MaxTargets = 20; NetBufferSize = 10240; SoftLimit = MAXCLIENTS; @@ -61,7 +59,6 @@ ServerConfig::ServerConfig() MaxWhoResults = 100; debugging = 0; LogLevel = DEFAULT; - DieDelay = 5; } void ServerConfig::ClearStack() @@ -236,6 +233,7 @@ void ServerConfig::Read(bool bail, userrec* user) ConfValue("options","customversion",0,Config->CustomVersion,&Config->config_f); ConfValue("options","maxtargets",0,MT,&Config->config_f); ConfValue("options","hidesplits",0,HS,&Config->config_f); + ConfValue("options","hidebans",0,HB,&Config->config_f); ConfValue("options","hidewhois",0,Config->HideWhoisServer,&Config->config_f); ConfValue("options","tempdir",0,Config->TempDir,&Config->config_f); @@ -244,6 +242,7 @@ void ServerConfig::Read(bool bail, userrec* user) if (!*Config->TempDir) strlcpy(Config->TempDir,"/tmp",1024); Config->HideSplits = ((*HS == 'y') || (*HS == 'Y') || (*HS == '1') || (*HS == 't') || (*HS == 'T')); + Config->HideBans = ((*HB == 'y') || (*HB == 'Y') || (*HB == '1') || (*HB == 't') || (*HB == 'T')); Config->SoftLimit = atoi(SLIMT); if (*MT) Config->MaxTargets = atoi(MT); diff --git a/src/svn-rev.sh b/src/svn-rev.sh index 4024150c1..cb126af2f 100755 --- a/src/svn-rev.sh +++ b/src/svn-rev.sh @@ -1 +1 @@ -echo 3381 +echo 3383 diff --git a/src/xline.cpp b/src/xline.cpp index accb5ce9f..56e7495bb 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -691,7 +691,7 @@ void apply_lines(const int What) { if ((check = matches_qline(u->nick))) { - snprintf(reason,MAXBUF,"Matched Q-Lined nick: %s",check); + snprintf(reason,MAXBUF,"Q-Lined: %s",check); Goners->AddItem(u,reason); } } -- cgit v1.2.3