mirror of
https://github.com/anope/anope.git
synced 2026-07-05 11:03:12 +02:00
Added a default expiry time for suspended and forbidden nicks and channels
This commit is contained in:
@@ -934,6 +934,18 @@ nickserv
|
||||
*/
|
||||
expire = 21d
|
||||
|
||||
/*
|
||||
* The length of time before a suspended nick becomes unsuspended. This directive is optional.
|
||||
* If not set, the default is to never.
|
||||
*/
|
||||
#suspendexpire = 90d
|
||||
|
||||
/*
|
||||
* The lenth of time before a forbidden nick drops. This directive is optional. If not set, the
|
||||
* default is to never.
|
||||
*/
|
||||
#forbidexpire = 90d
|
||||
|
||||
/*
|
||||
* The length of time a user gets to enter the confirmation code which has been e-mailed
|
||||
* to them before the nick will be released for general use again. This directive is
|
||||
@@ -1089,6 +1101,18 @@ chanserv
|
||||
*/
|
||||
expire = 14d
|
||||
|
||||
/*
|
||||
* The length of time before a suspended channel becomes unsuspended. This directive is optional.
|
||||
* If not set, the default is to never.
|
||||
*/
|
||||
#suspendexpire = 90d
|
||||
|
||||
/*
|
||||
* The lenth of time before a forbidden channel drops. This directive is optional. If not set, the
|
||||
* default is to never.
|
||||
*/
|
||||
#forbidexpire = 90d
|
||||
|
||||
/*
|
||||
* The default ban type for newly registered channels (and when importing old databases).
|
||||
*
|
||||
|
||||
@@ -2,6 +2,8 @@ Anope Version 1.9.4
|
||||
-------------------
|
||||
memoserv:modules added ms_ignore
|
||||
chanserv:modules added cs_clone and cs_mode
|
||||
nickserv:suspendexpire and nickserv:forbidexpire added
|
||||
chanserv:suspendexpire and chanserv:forbidexpire added
|
||||
|
||||
Anope Version 1.9.3
|
||||
------------------
|
||||
|
||||
+9
-1
@@ -593,8 +593,12 @@ class CoreExport ServerConfig
|
||||
time_t NSRegDelay;
|
||||
/* Time before the registering mail will be resent */
|
||||
time_t NSResendDelay;
|
||||
/* How long before nicks expir */
|
||||
/* How long before nicks expire */
|
||||
time_t NSExpire;
|
||||
/* How long before suspended nicks expire */
|
||||
time_t NSSuspendExpire;
|
||||
/* How long before forbidden nicks expire */
|
||||
time_t NSForbidExpire;
|
||||
/* Time before NickRequests expire */
|
||||
time_t NSRExpire;
|
||||
/* Force email when registering */
|
||||
@@ -630,6 +634,10 @@ class CoreExport ServerConfig
|
||||
unsigned CSMaxReg;
|
||||
/* Time before a channel expires */
|
||||
time_t CSExpire;
|
||||
/* How long before suspended channels expire */
|
||||
time_t CSSuspendExpire;
|
||||
/* How long before forbidden channels expire */
|
||||
time_t CSForbidExpire;
|
||||
/* Default ban type to use for channels */
|
||||
int CSDefBantype;
|
||||
/* Max number of entries allowed on channel access lists */
|
||||
|
||||
+3
-3
@@ -498,10 +498,10 @@ class CoreExport Module : public Extensible
|
||||
*/
|
||||
virtual EventReturn OnPreChanExpire(ChannelInfo *ci) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when a channel expires
|
||||
* @param chname The channel name
|
||||
/** Called before a channel expires
|
||||
* @param ci The channel
|
||||
*/
|
||||
virtual void OnChanExpire(const Anope::string &chname) { }
|
||||
virtual void OnChanExpire(ChannelInfo *ci) { }
|
||||
|
||||
/** Called before Anope connects to its uplink
|
||||
* @param u The uplink we're going to connect to
|
||||
|
||||
@@ -247,7 +247,7 @@ class CommandOSAKill : public Command
|
||||
|
||||
if (SGLine->GetList().empty())
|
||||
{
|
||||
u->SendMessage(OperServ, OPER_AKILL_LIST_EMPTY);
|
||||
u->SendMessage(OperServ, OPER_LIST_EMPTY);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ class CommandOSAKill : public Command
|
||||
{
|
||||
if (SGLine->GetList().empty())
|
||||
{
|
||||
u->SendMessage(OperServ, OPER_AKILL_LIST_EMPTY);
|
||||
u->SendMessage(OperServ, OPER_LIST_EMPTY);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class CommandOSAKill : public Command
|
||||
{
|
||||
if (SGLine->GetList().empty())
|
||||
{
|
||||
u->SendMessage(OperServ, OPER_AKILL_LIST_EMPTY);
|
||||
u->SendMessage(OperServ, OPER_LIST_EMPTY);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
+26
-4
@@ -363,17 +363,39 @@ void expire_chans()
|
||||
ChannelInfo *ci = it->second;
|
||||
++it;
|
||||
|
||||
if (!ci->c && Anope::CurTime - ci->last_used >= Config->CSExpire && !ci->HasFlag(CI_FORBIDDEN) && !ci->HasFlag(CI_NO_EXPIRE) && !ci->HasFlag(CI_SUSPENDED))
|
||||
bool expire = false;
|
||||
if (ci->HasFlag(CI_SUSPENDED))
|
||||
{
|
||||
if (Config->CSSuspendExpire && Anope::CurTime - ci->last_used >= Config->CSSuspendExpire)
|
||||
expire = true;
|
||||
}
|
||||
else if (ci->HasFlag(CI_FORBIDDEN))
|
||||
{
|
||||
if (Config->CSForbidExpire && Anope::CurTime - ci->last_used >= Config->CSForbidExpire)
|
||||
expire = true;
|
||||
}
|
||||
else if (!ci->c && Anope::CurTime - ci->last_used >= Config->CSExpire)
|
||||
expire = true;
|
||||
|
||||
if (ci->HasFlag(CI_NO_EXPIRE))
|
||||
expire = true;
|
||||
|
||||
if (expire)
|
||||
{
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(I_OnPreChanExpire, OnPreChanExpire(ci));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
continue;
|
||||
|
||||
Anope::string chname = ci->name;
|
||||
Log(LOG_NORMAL, "chanserv/expire") << "Expiring channel " << ci->name << " (founder: " << (ci->founder ? ci->founder->display : "(none)") << " )";
|
||||
Anope::string extra;
|
||||
if (ci->HasFlag(CI_FORBIDDEN))
|
||||
extra = "forbidden ";
|
||||
else if (ci->HasFlag(CI_SUSPENDED))
|
||||
extra = "suspended ";
|
||||
|
||||
Log(LOG_NORMAL, "chanserv/expire") << "Expiring " << extra << "channel " << ci->name << " (founder: " << (ci->founder ? ci->founder->display : "(none)") << ")";
|
||||
FOREACH_MOD(I_OnChanExpire, OnChanExpire(ci));
|
||||
delete ci;
|
||||
FOREACH_MOD(I_OnChanExpire, OnChanExpire(chname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,6 +1099,8 @@ void ServerConfig::Read()
|
||||
{"nickserv", "regdelay", "0", new ValueContainerTime(&this->NSRegDelay), DT_TIME, NoValidation},
|
||||
{"nickserv", "resenddelay", "0", new ValueContainerTime(&this->NSResendDelay), DT_TIME, NoValidation},
|
||||
{"nickserv", "expire", "21d", new ValueContainerTime(&this->NSExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "suspendexpire", "0", new ValueContainerTime(&this->NSSuspendExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "forbidexpire", "0", new ValueContainerTime(&this->NSForbidExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "preregexpire", "0", new ValueContainerTime(&this->NSRExpire), DT_TIME, ValidateEmailReg},
|
||||
{"nickserv", "maxaliases", "0", new ValueContainerUInt(&this->NSMaxAliases), DT_UINTEGER, NoValidation},
|
||||
{"nickserv", "accessmax", "0", new ValueContainerUInt(&this->NSAccessMax), DT_UINTEGER, ValidateNotZero},
|
||||
@@ -1127,6 +1129,8 @@ void ServerConfig::Read()
|
||||
{"chanserv", "defaults", "keeptopic secure securefounder signkick", new ValueContainerString(&CSDefaults), DT_STRING, ValidateChanServ},
|
||||
{"chanserv", "maxregistered", "0", new ValueContainerUInt(&this->CSMaxReg), DT_UINTEGER, ValidateChanServ},
|
||||
{"chanserv", "expire", "14d", new ValueContainerTime(&this->CSExpire), DT_TIME, ValidateChanServ},
|
||||
{"chanserv", "suspendexpire", "0", new ValueContainerTime(&this->CSSuspendExpire), DT_TIME, NoValidation},
|
||||
{"chanserv", "forbidexpire", "0", new ValueContainerTime(&this->CSForbidExpire), DT_TIME, NoValidation},
|
||||
{"chanserv", "defbantype", "2", new ValueContainerInt(&this->CSDefBantype), DT_INTEGER, ValidateChanServ},
|
||||
{"chanserv", "accessmax", "0", new ValueContainerUInt(&this->CSAccessMax), DT_UINTEGER, ValidateChanServ},
|
||||
{"chanserv", "autokickmax", "0", new ValueContainerUInt(&this->CSAutokickMax), DT_UINTEGER, ValidateChanServ},
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore)
|
||||
else if (!nickcore)
|
||||
throw CoreException("Empty nickcore passed to NickAlias constructor");
|
||||
|
||||
this->time_registered = this->last_seen = 0;
|
||||
this->time_registered = this->last_seen = Anope::CurTime;
|
||||
|
||||
this->nick = nickname;
|
||||
this->nc = nickcore;
|
||||
|
||||
+23
-2
@@ -257,13 +257,34 @@ void expire_nicks()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Config->NSExpire && Anope::CurTime - na->last_seen >= Config->NSExpire && !na->HasFlag(NS_FORBIDDEN) && !na->HasFlag(NS_NO_EXPIRE) && !na->nc->HasFlag(NI_SUSPENDED))
|
||||
bool expire = false;
|
||||
if (na->nc->HasFlag(NI_SUSPENDED))
|
||||
{
|
||||
if (Config->NSSuspendExpire && Anope::CurTime - na->last_seen >= Config->NSSuspendExpire)
|
||||
expire = true;
|
||||
}
|
||||
else if (na->HasFlag(NS_FORBIDDEN))
|
||||
{
|
||||
if (Config->NSForbidExpire && Anope::CurTime - na->last_seen >= Config->NSForbidExpire)
|
||||
expire = true;
|
||||
}
|
||||
else if (Config->NSExpire && Anope::CurTime - na->last_seen >= Config->NSExpire)
|
||||
expire = true;
|
||||
if (na->HasFlag(NS_NO_EXPIRE))
|
||||
expire = false;
|
||||
|
||||
if (expire)
|
||||
{
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(I_OnPreNickExpire, OnPreNickExpire(na));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
continue;
|
||||
Log(LOG_NORMAL, "expire") << "Expiring nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
|
||||
Anope::string extra;
|
||||
if (na->HasFlag(NS_FORBIDDEN))
|
||||
extra = "forbidden ";
|
||||
else if (na->nc->HasFlag(NI_SUSPENDED))
|
||||
extra = "suspended ";
|
||||
Log(LOG_NORMAL, "expire") << "Expiring " << extra << "nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
|
||||
FOREACH_MOD(I_OnNickExpire, OnNickExpire(na));
|
||||
delete na;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user