summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-04 18:37:14 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-04 18:37:14 +0000
commit8923de4c4ff8e48f15baf8ca5914f664012cbd8d (patch)
tree53462792596edd1c36d257232159b38b0e09fdcf
parentcadc11999ee28545e9beb92de116c151832af5c4 (diff)
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
-rw-r--r--src/modules.cpp31
1 files 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;
}