diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-26 21:45:15 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-26 21:45:15 +0000 |
commit | d63e0473ba5b9117d484cf58af78832515334e3a (patch) | |
tree | e0a62e2080bfaa37900a31330180f3bc95e4f96b | |
parent | 030a57b3f31c057e2e8574c1ab7e09f3982252ca (diff) |
Added global_implementation array, bypasses calls which *NO* modules are currently implementing
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2670 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/inspircd_io.h | 4 | ||||
-rw-r--r-- | include/modules.h | 12 | ||||
-rw-r--r-- | src/inspircd.cpp | 10 |
3 files changed, 22 insertions, 4 deletions
diff --git a/include/inspircd_io.h b/include/inspircd_io.h index 86ab543a5..5319f8c59 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -255,6 +255,10 @@ class ServerConfig : public classbase */ char implement_lists[255][255]; + /** Global implementation list + */ + char global_implementation[255]; + /** A list of ports claimed by IO Modules */ std::map<int,Module*> IOHookModule; diff --git a/include/modules.h b/include/modules.h index 264354db9..460cc6566 100644 --- a/include/modules.h +++ b/include/modules.h @@ -80,10 +80,12 @@ typedef std::deque<userrec*> chanuserlist; // loaded modules in a readable simple way, e.g.: // 'FOREACH_MOD OnConnect(user);' -#define FOREACH_MOD(y,x) for (int _i = 0; _i <= MODCOUNT; _i++) { \ +#define FOREACH_MOD(y,x) if (Config->global_implementation[y] > 0) { \ + for (int _i = 0; _i <= MODCOUNT; _i++) { \ if (Config->implement_lists[_i][y]) \ modules[_i]->x ; \ - } + } \ + } // This define is similar to the one above but returns a result in MOD_RESULT. // The first module to return a nonzero result is the value to be accepted, @@ -91,7 +93,8 @@ typedef std::deque<userrec*> chanuserlist; // ********************************************************************************************* -#define FOREACH_RESULT(y,x) { MOD_RESULT = 0; \ +#define FOREACH_RESULT(y,x) { if (Config->global_implementation[y] > 0) { \ + MOD_RESULT = 0; \ for (int _i = 0; _i <= MODCOUNT; _i++) { \ if (Config->implement_lists[_i][y]) {\ int res = modules[_i]->x ; \ @@ -101,7 +104,8 @@ typedef std::deque<userrec*> chanuserlist; } \ } \ } \ - } + } \ + } // ********************************************************************************************* diff --git a/src/inspircd.cpp b/src/inspircd.cpp index f15fba3a0..b560a2de6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -193,6 +193,9 @@ InspIRCd::InspIRCd(int argc, char** argv) CheckDie(); stats->BoundPortCount = BindPorts(); + for(int t = 0; t < 255; t++) + Config->global_implementation[t] = 0; + printf("\n"); if (!Config->nofork) { @@ -294,6 +297,10 @@ bool InspIRCd::UnloadModule(const char* filename) { modules[j]->OnCleanup(TYPE_USER,u->second); } + + for(int t = 0; t < 255; t++) + Config->global_implementation[t] -= implement_lists[j][t]; + FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(modules[j],Config->module_names[j])); // found the module log(DEBUG,"Deleting module..."); @@ -365,6 +372,9 @@ bool InspIRCd::LoadModule(const char* filename) x[t] = 0; modules[MODCOUNT+1]->Implements(x); + + for(int t = 0; t < 255; t++) + Config->global_implementation[t] += implement_lists[MODCOUNT+1][t]; } else { |