diff options
-rw-r--r-- | include/modules.h | 15 | ||||
-rw-r--r-- | src/modules.cpp | 14 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_abbreviation.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_banredirect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_cloaking.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_conn_join.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_umodes.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_hostchange.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nicklock.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_securelist.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spy.cpp | 2 |
15 files changed, 23 insertions, 34 deletions
diff --git a/include/modules.h b/include/modules.h index 64eb3cfd1..536313d8f 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1602,17 +1602,6 @@ typedef std::vector<Module*> IntModuleList; */ typedef IntModuleList::iterator EventHandlerIter; -/** Module priority states - */ -enum PriorityState -{ - PRIO_DONTCARE, - PRIO_FIRST, - PRIO_LAST, - PRIO_AFTER, - PRIO_BEFORE -}; - /** ModuleManager takes care of all things module-related * in the core. */ @@ -1680,7 +1669,7 @@ class CoreExport ModuleManager : public classbase * Defaults to 1, as most of the time you will only want to prioritize your module * to be before or after one other module. */ - bool SetPriority(Module* mod, Implementation i, PriorityState s, Module** modules = NULL, size_t sz = 1); + bool SetPriority(Module* mod, Implementation i, Priority s, Module** modules = NULL, size_t sz = 1); /** Change the priority of all events in a module. * @param mod The module to set the priority of @@ -1690,7 +1679,7 @@ class CoreExport ModuleManager : public classbase * SetPriority method for this, where you may specify other modules to * be prioritized against. */ - bool SetPriority(Module* mod, PriorityState s); + bool SetPriority(Module* mod, Priority s); /** Attach an event to a module. * You may later detatch the event with ModuleManager::Detach(). diff --git a/src/modules.cpp b/src/modules.cpp index 77ba52269..db14fd1e6 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -238,7 +238,7 @@ void ModuleManager::DetachAll(Module* mod) Detach((Implementation)n, mod); } -bool ModuleManager::SetPriority(Module* mod, PriorityState s) +bool ModuleManager::SetPriority(Module* mod, Priority s) { for (size_t n = I_BEGIN + 1; n != I_END; ++n) SetPriority(mod, (Implementation)n, s); @@ -246,7 +246,7 @@ bool ModuleManager::SetPriority(Module* mod, PriorityState s) return true; } -bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, Module** modules, size_t sz) +bool ModuleManager::SetPriority(Module* mod, Implementation i, Priority s, Module** modules, size_t sz) { /** To change the priority of a module, we first find its position in the vector, * then we find the position of the other modules in the vector that this module @@ -281,22 +281,22 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, switch (s) { /* Dummy value */ - case PRIO_DONTCARE: + case PRIORITY_DONTCARE: swap = false; break; /* Module wants to be first, sod everything else */ - case PRIO_FIRST: + case PRIORITY_FIRST: swap_pos = 0; break; /* Module is submissive and wants to be last... awww. */ - case PRIO_LAST: + case PRIORITY_LAST: if (EventHandlers[i].empty()) swap_pos = 0; else swap_pos = EventHandlers[i].size() - 1; break; /* Place this module after a set of other modules */ - case PRIO_AFTER: + case PRIORITY_AFTER: { /* Find the latest possible position */ swap_pos = 0; @@ -315,7 +315,7 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, } break; /* Place this module before a set of other modules */ - case PRIO_BEFORE: + case PRIORITY_BEFORE: { swap_pos = EventHandlers[i].size() - 1; swap = false; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 4d3c8fd86..a6d2760ee 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -933,7 +933,7 @@ class ModuleSSLGnuTLS : public Module void Prioritize() { Module* server = ServerInstance->Modules->Find("m_spanningtree.so"); - ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIO_AFTER, &server); + ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_AFTER, &server); } }; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index ee15ee88c..b5a2741f9 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -882,7 +882,7 @@ class ModuleSSLOpenSSL : public Module void Prioritize() { Module* server = ServerInstance->Modules->Find("m_spanningtree.so"); - ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIO_AFTER, &server); + ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_AFTER, &server); } }; diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index a5735edab..f29ad1b58 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -25,7 +25,7 @@ class ModuleAbbreviation : public Module { Me->Modules->Attach(I_OnPreCommand, this); /* Must do this first */ - Me->Modules->SetPriority(this, I_OnPreCommand, PRIO_FIRST); + Me->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); } virtual Version GetVersion() diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 7a24dc545..72f585f02 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -339,7 +339,7 @@ class ModuleBanRedirect : public Module void Prioritize() { Module* banex = ServerInstance->Modules->Find("m_banexception.so"); - ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIO_BEFORE, &banex); + ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIORITY_BEFORE, &banex); } }; diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index cb6532d51..14c4bd0c7 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -156,7 +156,7 @@ public: virtual void Prioritize() { - ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIO_FIRST); + ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_FIRST); } virtual void OnRehash(User* user, const std::string ¶meter) diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 31f9eea5d..7eb2abd17 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -332,11 +332,11 @@ class ModuleCloaking : public Module void Prioritize() { /* Needs to be after m_banexception etc. */ - ServerInstance->Modules->SetPriority(this, I_OnCheckBan, PRIO_LAST); + ServerInstance->Modules->SetPriority(this, I_OnCheckBan, PRIORITY_LAST); /* but before m_conn_umodes, so host is generated ready to apply */ Module *um = ServerInstance->Modules->Find("m_conn_umodes.so"); - ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIO_AFTER, &um); + ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_AFTER, &um); } virtual void OnUserDisconnect(User* user) diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index d9f22ccc5..29645b239 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -52,7 +52,7 @@ class ModuleConnJoin : public Module void Prioritize() { - ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIO_LAST); + ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_LAST); } diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 26670a749..c091691c6 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -29,7 +29,7 @@ class ModuleModesOnConnect : public Module Implementation eventlist[] = { I_OnUserConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); // for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t - ServerInstance->Modules->SetPriority(this, PRIO_FIRST); + ServerInstance->Modules->SetPriority(this, PRIORITY_FIRST); } diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 662ba5e60..d54076b43 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -56,7 +56,7 @@ class ModuleHostChange : public Module void Prioritize() { Module* cloak = ServerInstance->Modules->Find("m_cloaking.so"); - ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIO_AFTER, &cloak); + ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_AFTER, &cloak); } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index a16d651e9..d475d59e0 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -196,7 +196,7 @@ class ModuleNickLock : public Module void Prioritize() { Module *nflood = ServerInstance->Modules->Find("m_nickflood.so"); - ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIO_BEFORE, &nflood); + ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIORITY_BEFORE, &nflood); } virtual void OnCleanup(int target_type, void* item) diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 2d55e3ced..1b0424ddb 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -87,7 +87,7 @@ class ModuleSecureList : public Module void Prioritize() { Module* safelist = ServerInstance->Modules->Find("m_safelist.so"); - ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIO_BEFORE, &safelist); + ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_BEFORE, &safelist); } }; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 511465084..da393858c 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -931,7 +931,7 @@ Version ModuleSpanningTree::GetVersion() */ void ModuleSpanningTree::Prioritize() { - ServerInstance->Modules->SetPriority(this, PRIO_LAST); + ServerInstance->Modules->SetPriority(this, PRIORITY_LAST); } MODULE_INIT(ModuleSpanningTree) diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index cc8a08674..d00983971 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -36,7 +36,7 @@ class ModuleSpy : public Module { /* To ensure that we get priority over namesx and delayjoin for names list generation */ Module* list[] = { ServerInstance->Modules->Find("m_namesx.so"), ServerInstance->Modules->Find("m_delayjoin.so") }; - ServerInstance->Modules->SetPriority(this, I_OnUserList, PRIO_BEFORE, list, 2); + ServerInstance->Modules->SetPriority(this, I_OnUserList, PRIORITY_BEFORE, list, 2); } virtual ~ModuleSpy() |