mirror of
https://github.com/anope/anope.git
synced 2026-07-04 19:33:12 +02:00
Get rid of the remaining references in the core to specific services. Move more stuff out of the core to the proper modules.
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/os_session.h"
|
||||
|
||||
@@ -90,7 +88,7 @@ class MySessionService : public SessionService
|
||||
return this->Exceptions;
|
||||
}
|
||||
|
||||
void DelSession(Session *s) anope_override
|
||||
void DelSession(Session *s)
|
||||
{
|
||||
this->Sessions.erase(s->addr);
|
||||
}
|
||||
@@ -125,28 +123,6 @@ class MySessionService : public SessionService
|
||||
}
|
||||
};
|
||||
|
||||
class ExpireTimer : public Timer
|
||||
{
|
||||
public:
|
||||
ExpireTimer() : Timer(Config->GetBlock("options")->Get<time_t>("expiretimeout"), Anope::CurTime, true) { }
|
||||
|
||||
void Tick(time_t) anope_override
|
||||
{
|
||||
if (!session_service || Anope::NoExpire)
|
||||
return;
|
||||
for (unsigned i = session_service->GetExceptions().size(); i > 0; --i)
|
||||
{
|
||||
Exception *e = session_service->GetExceptions()[i - 1];
|
||||
|
||||
if (!e->expires || e->expires > Anope::CurTime)
|
||||
continue;
|
||||
Log(OperServ, "expire/exception") << "Session exception for " << e->mask << "has expired.";
|
||||
session_service->DelException(e);
|
||||
delete e;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ExceptionDelCallback : public NumberList
|
||||
{
|
||||
protected:
|
||||
@@ -633,7 +609,6 @@ class OSSession : public Module
|
||||
{
|
||||
Serialize::Type exception_type;
|
||||
MySessionService ss;
|
||||
ExpireTimer expiretimer;
|
||||
CommandOSSession commandossession;
|
||||
CommandOSException commandosexception;
|
||||
ServiceReference<XLineManager> akills;
|
||||
@@ -644,7 +619,7 @@ class OSSession : public Module
|
||||
{
|
||||
this->SetPermanent(true);
|
||||
|
||||
Implementation i[] = { I_OnReload, I_OnUserConnect, I_OnUserQuit };
|
||||
Implementation i[] = { I_OnReload, I_OnUserConnect, I_OnUserQuit, I_OnExpireTick };
|
||||
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
|
||||
ModuleManager::SetPriority(this, PRIORITY_FIRST);
|
||||
}
|
||||
@@ -706,6 +681,7 @@ class OSSession : public Module
|
||||
|
||||
if (kill && !exempt)
|
||||
{
|
||||
BotInfo *OperServ = Config->GetClient("OperServ");
|
||||
if (OperServ)
|
||||
{
|
||||
if (!sle_reason.empty())
|
||||
@@ -760,6 +736,23 @@ class OSSession : public Module
|
||||
delete session;
|
||||
sessions.erase(sit);
|
||||
}
|
||||
|
||||
void OnExpireTick() anope_override
|
||||
{
|
||||
if (!Anope::NoExpire)
|
||||
return;
|
||||
for (unsigned i = this->ss.GetExceptions().size(); i > 0; --i)
|
||||
{
|
||||
Exception *e = this->ss.GetExceptions()[i - 1];
|
||||
|
||||
if (!e->expires || e->expires > Anope::CurTime)
|
||||
continue;
|
||||
BotInfo *OperServ = Config->GetClient("OperServ");
|
||||
Log(OperServ, "expire/exception") << "Session exception for " << e->mask << "has expired.";
|
||||
this->ss.DelException(e);
|
||||
delete e;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(OSSession)
|
||||
|
||||
Reference in New Issue
Block a user