1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 14:36:38 +02:00

Move EVENT_RELOAD to OnReload.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2103 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
rburchell
2009-02-16 23:48:03 +00:00
parent c1c9e17d79
commit d07de70fc3
8 changed files with 33 additions and 75 deletions
-1
View File
@@ -38,7 +38,6 @@
#define EVENT_CONNECT "connect"
#define EVENT_DB_EXPIRE "db_expire"
#define EVENT_RESTART "restart"
#define EVENT_RELOAD "reload"
#define EVENT_SHUTDOWN "shutdown"
#define EVENT_SIGNAL "signal"
#define EVENT_NICK_REGISTERED "nick_registered"
+6 -1
View File
@@ -104,7 +104,7 @@ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFOR
enum Implementation
{
I_BEGIN,
I_OnUserKicked,
I_OnUserKicked, I_OnReload,
I_END
};
@@ -490,6 +490,11 @@ class CoreExport Module
* NOTE: We may want to add a second User arg for sender in the future.
*/
virtual void OnUserKicked(Channel *c, User *target, const std::string &kickmsg) { }
/** Called when Services' configuration has been loaded.
* @param startup True if Services is starting for the first time, false otherwise.
*/
virtual void OnReload(bool startup) {}
};
+5 -17
View File
@@ -34,7 +34,6 @@
void myOperServHelp(User *u);
int reload_config(int argc, char **argv);
struct newsmsgs {
int16 type;
@@ -381,10 +380,12 @@ class OSNews : public Module
this->AddCommand(OPERSERV, new CommandOSRandomNews(), MOD_UNIQUE);
this->SetOperHelp(myOperServHelp);
}
EvtHook *hook = createEventHook(EVENT_RELOAD, reload_config);
if (this->AddEventHook(hook) != MOD_ERR_OK)
throw ModuleException("os_news: Can't hook to EVENT_RELOAD event");
void reload_config(bool starting)
{
OSLogonNews->UpdateHelpParam();
OSOperNews->UpdateHelpParam();
}
};
@@ -403,18 +404,5 @@ void myOperServHelp(User *u)
}
}
/**
* Upon /os reload refresh the count
**/
int reload_config(int argc, char **argv)
{
if (argc >= 1 && !stricmp(argv[0], EVENT_START))
{
OSLogonNews->UpdateHelpParam();
OSOperNews->UpdateHelpParam();
}
return MOD_CONT;
}
MODULE_INIT("os_news", OSNews)
+2 -1
View File
@@ -35,7 +35,8 @@ class CommandOSReload : public Command
sprintf(const_cast<char *>(quitmsg), /* XXX */ "Error during the reload of the configuration file!");
quitting = 1;
}
send_event(EVENT_RELOAD, 1, EVENT_START);
FOREACH_MOD(I_OnReload, OnReload(false));
notice_lang(s_OperServ, u, OPER_RELOAD);
return MOD_CONT;
}
+1 -1
View File
@@ -260,7 +260,7 @@ void sighandler(int signum)
quitting = 1;
}
send_event(EVENT_RELOAD, 1, EVENT_START);
FOREACH_MOD(I_OnReload, OnReload(true));
return;
} else
+5 -13
View File
@@ -20,7 +20,6 @@
void my_load_config();
void my_add_languages();
int my_event_reload(int argc, char **argv);
CommandReturn check_email_limit_reached(const char *email, User * u);
int NSEmailMax = 0;
@@ -90,10 +89,6 @@ class NSMaxEmail : public Module
this->AddCommand(NICKSERV, new CommandNSRegister(), MOD_HEAD);
this->AddCommand(NICKSERV, new CommandNSSet(), MOD_HEAD);
evt = createEventHook(EVENT_RELOAD, my_event_reload);
if ((status = this->AddEventHook(evt)))
throw ModuleException("ns_maxemail: Unable to hook to EVENT_RELOAD");
my_load_config();
const char *langtable_en_us[] = {
@@ -145,6 +140,11 @@ class NSMaxEmail : public Module
this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru);
this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it);
}
void OnReload(bool started)
{
my_load_config();
}
};
@@ -185,14 +185,6 @@ CommandReturn check_email_limit_reached(const char *email, User * u)
return MOD_STOP;
}
int my_event_reload(int argc, char **argv)
{
if (argc > 0 && !stricmp(argv[0], EVENT_START))
my_load_config();
return MOD_CONT;
}
void my_load_config()
{
ConfigReader config;
+5 -16
View File
@@ -72,7 +72,6 @@ int backup_ignoredb(int argc, char **argv);
void load_ignore_db();
void save_ignore_db();
void load_config();
int reload_config(int argc, char **argv);
/* ------------------------------------------------------------------------------- */
@@ -88,10 +87,6 @@ class OSIgnoreDB : public Module
this->SetVersion(VERSION);
this->SetType(SUPPORTED);
hook = createEventHook(EVENT_RELOAD, reload_config);
if (this->AddEventHook(hook) != MOD_ERR_OK)
throw ModuleException("os_ignore_db: Can't hook to EVENT_RELOAD event");
hook = createEventHook(EVENT_DB_SAVING, save_ignoredb);
if (this->AddEventHook(hook) != MOD_ERR_OK)
throw ModuleException("os_ignore_db: Can't hook to EVENT_DB_SAVING event");
@@ -113,6 +108,11 @@ class OSIgnoreDB : public Module
if (IgnoreDB)
delete [] IgnoreDB;
}
void OnReload(bool starting)
{
load_config();
}
};
@@ -132,17 +132,6 @@ void load_config() {
alog("[os_ignore_db] debug: Set config vars: OSIgnoreDBName='%s'", IgnoreDB);
}
/**
* Upon /os reload call the routines for reloading the configuration directives
**/
int reload_config(int argc, char **argv) {
if (argc >= 1) {
if (!stricmp(argv[0], EVENT_START)) {
load_config();
}
}
return MOD_CONT;
}
/**
* When anope saves her databases, we do the same.
+9 -25
View File
@@ -49,7 +49,6 @@ int mLoadData();
int mSaveData(int argc, char **argv);
int mBackupData(int argc, char **argv);
int mLoadConfig();
int mEventReload(int argc, char **argv);
static Module *me;
@@ -311,9 +310,6 @@ class OSInfo : public Module
hook = createEventHook(EVENT_DB_BACKUP, mBackupData);
status = this->AddEventHook(hook);
hook = createEventHook(EVENT_RELOAD, mEventReload);
status = this->AddEventHook(hook);
this->SetNickHelp(mMainNickHelp);
this->SetChanHelp(mMainChanHelp);
@@ -557,6 +553,15 @@ class OSInfo : public Module
if (OSInfoDBName)
delete [] OSInfoDBName;
}
void OnReload(bool starting)
{
alog("os_info: Reloading configuration directives...");
int ret = mLoadConfig();
if (ret)
alog("os_info.c: ERROR: An error has occured while reloading the configuration file");
}
};
/*************************************************************************/
@@ -710,27 +715,6 @@ int mLoadConfig()
return 0;
}
/**
* Manage the RELOAD EVENT
* @return MOD_CONT
**/
int mEventReload(int argc, char **argv)
{
int ret = 0;
if (argc >= 1)
{
if (!stricmp(argv[0], EVENT_START))
{
alog("os_info: Reloading configuration directives...");
ret = mLoadConfig();
}
}
if (ret)
alog("os_info.c: ERROR: An error has occured while reloading the configuration file");
return MOD_CONT;
}
/*************************************************************************/