summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chanserv.cpp30
-rw-r--r--src/config.cpp4
-rw-r--r--src/nickalias.cpp2
-rw-r--r--src/nickserv.cpp25
4 files changed, 54 insertions, 7 deletions
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;
}