From 8923de4c4ff8e48f15baf8ca5914f664012cbd8d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 4 Nov 2007 18:37:14 +0000 Subject: All done... i think. Just tidying up to be done, removal of Implements() method from all modules. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8511 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/modules.cpp b/src/modules.cpp index adbc4fce7..67a37c573 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -268,12 +268,15 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, Instance->Log(DEBUG,"ModuleManager::SetPriority: My position: %u", source); - for (size_t n = 0; n < sz; ++n) + if (modules) { - if (modules[n]) - Instance->Log(DEBUG," Listed Module: [%08x] %s", modules[n], GetModuleName(modules[n]).c_str()); - else - Instance->Log(DEBUG," [null module]"); + for (size_t n = 0; n < sz; ++n) + { + if (modules[n]) + Instance->Log(DEBUG," Listed Module: [%08x] %s", modules[n], GetModuleName(modules[n]).c_str()); + else + Instance->Log(DEBUG," [null module]"); + } } switch (s) @@ -294,12 +297,16 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, { /* Find the latest possible position */ swap_pos = 0; + swap = false; for (size_t x = 0; x != EventHandlers[i].size(); ++x) { for (size_t n = 0; n < sz; ++n) { - if ((modules[n]) && (EventHandlers[i][x] == modules[n]) && (x >= swap_pos)) + if ((modules[n]) && (EventHandlers[i][x] == modules[n]) && (x >= swap_pos) && (source <= swap_pos)) + { swap_pos = x; + swap = true; + } } } } @@ -307,12 +314,16 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, case PRIO_BEFORE: { swap_pos = EventHandlers[i].size() - 1; + swap = false; for (size_t x = 0; x != EventHandlers[i].size(); ++x) { for (size_t n = 0; n < sz; ++n) { - if ((modules[n]) && (EventHandlers[i][x] == modules[n]) && (x <= swap_pos)) + if ((modules[n]) && (EventHandlers[i][x] == modules[n]) && (x <= swap_pos) && (source >= swap_pos)) + { + swap = true; swap_pos = x; + } } } } @@ -327,6 +338,12 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, else Instance->Log(DEBUG,"No need to swap"); + Instance->Log(DEBUG,"New ordering:"); + for (size_t x = 0; x != EventHandlers[i].size(); ++x) + { + Instance->Log(DEBUG," [%08x] %s", EventHandlers[i][x], GetModuleName(EventHandlers[i][x]).c_str()); + } + return true; } -- cgit v1.2.3