diff options
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | modules/commands/os_defcon.cpp | 9 | ||||
-rw-r--r-- | modules/commands/os_session.cpp | 3 | ||||
-rw-r--r-- | modules/extra/m_ldap_authentication.cpp | 3 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 3 | ||||
-rw-r--r-- | src/module.cpp | 4 | ||||
-rw-r--r-- | src/modulemanager.cpp | 2 |
7 files changed, 19 insertions, 7 deletions
diff --git a/include/modules.h b/include/modules.h index d3d0f64cc..0569fd33f 100644 --- a/include/modules.h +++ b/include/modules.h @@ -285,6 +285,8 @@ class CoreExport Module : public Extensible */ ModuleVersion GetVersion() const; + virtual void Prioritize(); + /* Everything below here are events. Modules must ModuleManager::Attach to these events * before they will be called. */ diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 247938049..da9621cfd 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -496,11 +496,6 @@ class OSDefcon : public Module XLine x("*@" + u->host, OperServ ? OperServ->nick : "defcon", Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID()); akills->Send(NULL, &x); } - if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) - { - u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason); - return; - } if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) { @@ -529,9 +524,9 @@ class OSDefcon : public Module ++session->hits; if (akills && DConfig.max_session_kill && session->hits >= DConfig.max_session_kill) { - XLine x("*@" + u->host, OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); + XLine x("*@" + session->addr.mask(), OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); akills->Send(NULL, &x); - Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << u->host << "\002 due to excessive connections"; + Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << session->addr.mask() << "\002 due to excessive connections"; } else { diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 41f3a420d..6e21a77c7 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -639,7 +639,10 @@ class OSSession : public Module exception_type("Exception", Exception::Unserialize), ss(this), commandossession(this), commandosexception(this), akills("XLineManager", "xlinemanager/sgline") { this->SetPermanent(true); + } + void Prioritize() anope_override + { ModuleManager::SetPriority(this, PRIORITY_FIRST); } diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index 115faa73e..01bafac45 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -220,7 +220,10 @@ class NSIdentifyLDAP : public Module { me = this; + } + void Prioritize() anope_override + { ModuleManager::SetPriority(this, PRIORITY_FIRST); } diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 6f744f22f..40cb1fe70 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -1258,7 +1258,10 @@ class ProtoUnreal : public Module { this->AddModes(); + } + void Prioritize() anope_override + { ModuleManager::SetPriority(this, PRIORITY_FIRST); } diff --git a/src/module.cpp b/src/module.cpp index d57538e59..96fa24f6f 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -101,6 +101,10 @@ void Module::SetAuthor(const Anope::string &nauthor) this->author = nauthor; } +void Module::Prioritize() +{ +} + ModuleVersion::ModuleVersion(int maj, int min, int pa) : version_major(maj), version_minor(min), version_patch(pa) { } diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 71e692dd2..2e7c624cd 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -265,6 +265,8 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) for (unsigned i = 0; i < I_SIZE; ++i) EventHandlers[i].push_back(m); + m->Prioritize(); + FOREACH_MOD(OnModuleLoad, (u, m)); return MOD_ERR_OK; |