summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example.conf24
-rw-r--r--docs/Changes.conf2
-rw-r--r--include/config.h10
-rw-r--r--include/modules.h6
-rw-r--r--modules/core/os_akill.cpp6
-rw-r--r--src/chanserv.cpp30
-rw-r--r--src/config.cpp4
-rw-r--r--src/nickalias.cpp2
-rw-r--r--src/nickserv.cpp25
9 files changed, 95 insertions, 14 deletions
diff --git a/data/example.conf b/data/example.conf
index 777e28748..cb5f77d25 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -935,6 +935,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
* only required if the e-mail registration option is enabled.
@@ -1090,6 +1102,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).
*
* defbantype can be:
diff --git a/docs/Changes.conf b/docs/Changes.conf
index def316054..45980c7ac 100644
--- a/docs/Changes.conf
+++ b/docs/Changes.conf
@@ -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
------------------
diff --git a/include/config.h b/include/config.h
index 0dfd70d9d..aef620b3c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -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 */
diff --git a/include/modules.h b/include/modules.h
index be5c14447..ac74a7372 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -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
diff --git a/modules/core/os_akill.cpp b/modules/core/os_akill.cpp
index 6473d20ef..fa1dca356 100644
--- a/modules/core/os_akill.cpp
+++ b/modules/core/os_akill.cpp
@@ -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;
}
diff --git a/src/chanserv.cpp b/src/chanserv.cpp
index c5e11e633..c19bf8a30 100644
--- a/src/chanserv.cpp
+++ b/src/chanserv.cpp
@@ -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));
}
}
}
diff --git a/src/config.cpp b/src/config.cpp
index 6dddd7691..d1c4e2cdc 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -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},
diff --git a/src/nickalias.cpp b/src/nickalias.cpp
index a67893888..4f404b023 100644
--- a/src/nickalias.cpp
+++ b/src/nickalias.cpp
@@ -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;
diff --git a/src/nickserv.cpp b/src/nickserv.cpp
index e21d85e45..6212c7d3e 100644
--- a/src/nickserv.cpp
+++ b/src/nickserv.cpp
@@ -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;
}