From ef048989f89eb15b4fc92b83f3ff58805e44a064 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 4 Jun 2007 19:10:25 +0000 Subject: [PATCH] Add options:moronbanner. Yes really, thats what its called. See the example config. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7232 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/inspircd.conf.example | 9 ++++++++- include/configreader.h | 4 ++++ src/configreader.cpp | 1 + src/users.cpp | 7 ++++++- src/xline.cpp | 16 ++++++++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example index f418afabb..2632f8f60 100644 --- a/docs/inspircd.conf.example +++ b/docs/inspircd.conf.example @@ -48,12 +48,13 @@ # # # # # # + network="Omega"> #-#-#-#-#-#-#-#-#-#-#-#- ADMIN INFORMATION -#-#-#-#-#-#-#-#-#-#-#-# @@ -889,6 +890,11 @@ # they will be ignored. You may add parameters for # # parameterised modes. # # # +# moronbanner - The NOTICE to show to users who are glined, zlined # +# klined or qlined when they are disconnected. This # +# is totally freeform, you may place any text here # +# you wish. # +# # #-#-#-#-#-#-#-#-#-#-#-#-#-#- TIME SYNC OPTIONS -#-#-#-#-#-#-#-#-#-#-#-# diff --git a/include/configreader.h b/include/configreader.h index e596e409d..4d5435b1c 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -234,6 +234,10 @@ class CoreExport ServerConfig : public Extensible * as defined by the administrator. */ char ServerName[MAXBUF]; + + /** Notice to give to users when they are Xlined + */ + char MoronBanner[MAXBUF]; /* Holds the network name the local server * belongs to. This is an arbitary field defined diff --git a/src/configreader.cpp b/src/configreader.cpp index 76aec8ee5..2d62f354a 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -593,6 +593,7 @@ void ServerConfig::Read(bool bail, userrec* user) InitialConfig Values[] = { {"options", "softlimit", MAXCLIENTS_S, new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit}, {"options", "somaxconn", SOMAXCONN_S, new ValueContainerInt (&this->MaxConn), DT_INTEGER, ValidateMaxConn}, + {"options", "moronbanner", "Youre banned!", new ValueContainerChar (this->MoronBanner), DT_CHARPTR, NoValidation}, {"server", "name", "", new ValueContainerChar (this->ServerName), DT_CHARPTR, ValidateServerName}, {"server", "description", "Configure Me", new ValueContainerChar (this->ServerDesc), DT_CHARPTR, NoValidation}, {"server", "network", "Network", new ValueContainerChar (this->Network), DT_CHARPTR, NoValidation}, diff --git a/src/users.cpp b/src/users.cpp index 196be89e9..2e3bc83d5 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -962,6 +962,8 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached, if (r) { char reason[MAXBUF]; + if (*Instance->Config->MoronBanner) + New->WriteServ("NOTICE %s :*** %s", New->nick, Instance->Config->MoronBanner); snprintf(reason,MAXBUF,"Z-Lined: %s",r->reason); userrec::QuitUser(Instance, New, reason); return; @@ -1053,6 +1055,8 @@ void userrec::FullConnect() { this->muted = true; char reason[MAXBUF]; + if (*ServerInstance->Config->MoronBanner) + this->WriteServ("NOTICE %s :*** %s", this->nick, ServerInstance->Config->MoronBanner); snprintf(reason,MAXBUF,"G-Lined: %s",r->reason); ServerInstance->GlobalCulls.AddItem(this, reason); return; @@ -1064,11 +1068,12 @@ void userrec::FullConnect() { this->muted = true; char reason[MAXBUF]; + if (*ServerInstance->Config->MoronBanner) + this->WriteServ("NOTICE %s :*** %s", this, ServerInstance->Config->MoronBanner); snprintf(reason,MAXBUF,"K-Lined: %s",n->reason); ServerInstance->GlobalCulls.AddItem(this, reason); return; } - } this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network); diff --git a/src/xline.cpp b/src/xline.cpp index b6721de09..7a1b4a8aa 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -684,6 +684,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_gline(u,true))) { snprintf(reason,MAXBUF,"G-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "G-Lined", reason); else @@ -696,6 +698,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_kline(u,true))) { snprintf(reason,MAXBUF,"K-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "K-Lined", reason); else @@ -708,6 +712,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_qline(u->nick,true))) { snprintf(reason,MAXBUF,"Q-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "Q-Lined", reason); else @@ -720,6 +726,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_zline(u->GetIPString(),true))) { snprintf(reason,MAXBUF,"Z-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "Z-Lined", reason); else @@ -752,6 +760,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_gline(u))) { snprintf(reason,MAXBUF,"G-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "G-Lined", reason); else @@ -763,6 +773,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_kline(u))) { snprintf(reason,MAXBUF,"K-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "K-Lined", reason); else @@ -774,6 +786,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_qline(u->nick))) { snprintf(reason,MAXBUF,"Q-Lined: %s",check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "Q-Lined", reason); else @@ -785,6 +799,8 @@ void XLineManager::apply_lines(const int What) if ((check = matches_zline(u->GetIPString()))) { snprintf(reason,MAXBUF,"Z-Lined: %s", check->reason); + if (*ServerInstance->Config->MoronBanner) + u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) ServerInstance->GlobalCulls.AddItem(u, "Z-Lined", reason); else -- 2.39.2