From 082c2bfb1ce2286de08da0fc2228b65380f11763 Mon Sep 17 00:00:00 2001 From: codemastr Date: Wed, 1 Aug 2001 17:01:59 +0000 Subject: [PATCH] Added set::anti-spam-quit-message-time idea from hybrid7 --- Changes | 1 + include/dynconf.h | 3 ++- src/s_conf.c | 5 +++++ src/s_user.c | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 93bf967a2..a8f079933 100644 --- a/Changes +++ b/Changes @@ -759,3 +759,4 @@ seen. gmtime warning still there - Removed some obsolete code - Added set::oper-only-stats which allows you to set any/all stats as oper only (* = all). Code is kind of ugly since some flags are case insensitive and C == H but it works and seems pretty fast. +- Added set::anti-spam-quit-message-time idea from hybrid7 diff --git a/include/dynconf.h b/include/dynconf.h index 46fa379be..b0a49656e 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -68,6 +68,7 @@ struct zConfiguration { char *oper_only_stats; int socksbantime; int maxchannelsperuser; + int anti_spam_quit_message_time; char *socksbanmessage; char *socksquitmessage; aNetwork network; @@ -95,7 +96,7 @@ extern aConfiguration iConf; #define NAME_SERVER iConf.name_server #define IDENT_CHECK iConf.ident_check #define OPER_ONLY_STATS iConf.oper_only_stats - +#define ANTI_SPAM_QUIT_MSG_TIME iConf.anti_spam_quit_message_time #define ircnetwork iConf.network.x_ircnetwork #define ircnet005 iConf.network.x_ircnet005 diff --git a/src/s_conf.c b/src/s_conf.c index 924e925d1..e5c680087 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -2142,6 +2142,9 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) else if (!strcmp(cep->ce_varname, "oper-auto-join")) { ircstrdup(OPER_AUTO_JOIN_CHANS, cep->ce_vardata); } + else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) { + ANTI_SPAM_QUIT_MSG_TIME = atime(cep->ce_vardata); + } else if (!strcmp(cep->ce_varname, "socks")) { for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { if (!strcmp(cepp->ce_varname, "ban-message")) { @@ -3763,6 +3766,8 @@ void report_dynconf(aClient *sptr) if (OPER_ONLY_STATS) sendto_one(sptr, ":%s %i %s :oper-only-stats: %s", me.name, RPL_TEXT, sptr->name, OPER_ONLY_STATS); + sendto_one(sptr, ":%s %i %s :anti-spam-quit-message-time: %d", me.name, RPL_TEXT, + sptr->name, ANTI_SPAM_QUIT_MSG_TIME); sendto_one(sptr, ":%s %i %s :options::show-opermotd: %d", me.name, RPL_TEXT, sptr->name, SHOWOPERMOTD); sendto_one(sptr, ":%s %i %s :options::hide-ulines: %d", me.name, RPL_TEXT, diff --git a/src/s_user.c b/src/s_user.c index 825fb37d0..00355809a 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -3086,6 +3086,9 @@ int m_quit(cptr, sptr, parc, parv) #ifdef CENSOR_QUIT ocomment = (char *)stripbadwords_channel(ocomment); #endif + if (!IsAnOper(sptr) && ANTI_SPAM_QUIT_MSG_TIME) + if (sptr->firsttime+ANTI_SPAM_QUIT_MSG_TIME > TStime()) + ocomment = parv[0]; strncpy(comment + strlen(comment), ocomment, TOPICLEN - 7); comment[TOPICLEN] = '\0'; return exit_client(cptr, sptr, sptr, comment);