diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-11 15:31:34 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-11 15:31:34 +0000 |
commit | 777c6cf07347fe96aee065046cbcbe4ac50fe1fb (patch) | |
tree | fe78d1e3e061d44ff8d713b5a50dc6ee84cadbe1 | |
parent | f06eed98099e6d9ba32aeb6f247e85e0914113d6 (diff) |
Added OnPostDatabaseLoad event, which triggers after the cores databases have been loaded AND immediatly after a module is loaded *if* the core has already been loaded
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2552 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/modules.h | 7 | ||||
-rw-r--r-- | src/init.c | 1 | ||||
-rw-r--r-- | src/modulemanager.cpp | 5 |
3 files changed, 12 insertions, 1 deletions
diff --git a/include/modules.h b/include/modules.h index 77986102e..5a2a5420b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -565,6 +565,11 @@ class CoreExport Module */ virtual void OnPostCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> ¶ms) { } + /** Called after the core has finished loading the databases, but before + * we connect to the server + */ + virtual void OnPostLoadDatabases() { } + /** Called when anope saves databases. * NOTE: This event is deprecated pending new database handling. * XXX. @@ -951,7 +956,7 @@ enum Implementation I_OnDefconLevel, /* Other */ - I_OnReload, I_OnPreServerConnect, I_OnServerConnect, I_OnPreCommand, I_OnPostCommand, I_OnSaveDatabase, I_OnBackupDatabase, + I_OnReload, I_OnPreServerConnect, I_OnServerConnect, I_OnPreCommand, I_OnPostCommand, I_OnPostLoadDatabases, I_OnSaveDatabase, I_OnBackupDatabase, I_OnPreDatabaseExpire, I_OnDatabaseExpire, I_OnPreRestart, I_OnRestart, I_OnPreShutdown, I_OnShutdown, I_OnSignal, I_OnServerQuit, I_OnTopicUpdated, I_OnEncrypt, I_OnEncryptInPlace, I_OnEncryptCheckLen, I_OnDecrypt, I_OnCheckPassword, diff --git a/src/init.c b/src/init.c index 4c87ae5c4..5cda3e198 100644 --- a/src/init.c +++ b/src/init.c @@ -606,6 +606,7 @@ int init_secondary(int ac, char **av) bi = new BotInfo(s_GlobalNoticer, ServiceUser, ServiceHost, desc_GlobalNoticer); } + FOREACH_MOD(I_OnPostLoadDatabases, OnPostLoadDatabases()); /* Save the databases back to file/mysql to reflect any changes */ alog("Info: Reflecting database records."); save_databases(); diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index e0fada619..68609421b 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -260,6 +260,11 @@ int ModuleManager::LoadModule(const std::string &modname, User * u) { ircdproto->SendGlobops(s_OperServ, "%s loaded module %s", u->nick, modname.c_str()); notice_lang(s_OperServ, u, OPER_MODULE_LOADED, modname.c_str()); + + /* If a user is loading this module, then the core databases have already been loaded + * so trigger the event manually + */ + m->OnPostLoadDatabases(); } return MOD_ERR_OK; |