diff options
| author | Adam <Adam@anope.org> | 2010-11-22 10:08:37 -0600 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-12-12 19:36:01 -0500 |
| commit | 697dc8938279f33f2ac2c0b2248793c75de07b19 (patch) | |
| tree | 3b8259dbded67f87f9e17742ebef5b0043e3ebdc /src/chanserv.cpp | |
| parent | 4d342d955dbe604357c652a1ee09d77c9a38ec6d (diff) | |
Added a default expiry time for suspended and forbidden nicks and channels
Diffstat (limited to 'src/chanserv.cpp')
| -rw-r--r-- | src/chanserv.cpp | 30 |
1 files changed, 26 insertions, 4 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)); } } } |
