1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 01:23:12 +02:00

Cleanup in main.cpp.

This commit is contained in:
Naram Qashat
2010-08-01 13:42:35 -04:00
parent 2f6c0e435c
commit d59c1b95e1
12 changed files with 50 additions and 54 deletions
+8 -11
View File
@@ -193,20 +193,17 @@ E Anope::string version_protocol;
E Anope::string services_dir;
E Anope::string log_filename;
E int debug;
E int readonly;
E bool readonly;
E bool LogChan;
E int nofork;
E int forceload;
E int nothird;
E int noexpire;
E int protocoldebug;
E bool nofork;
E bool nothird;
E bool noexpire;
E bool protocoldebug;
E int is44;
E int quitting;
E int shutting_down;
E bool quitting;
E bool shutting_down;
E Anope::string quitmsg;
E int save_data;
E int got_alarm;
E bool save_data;
E time_t start_time;
E Socket *UplinkSock;
+1 -1
View File
@@ -555,7 +555,7 @@ class DBPlain : public Module
Alog() << "Unable to back up database!";
if (!Config.NoBackupOkay)
quitting = 1;
quitting = true;
return;
}
+1 -1
View File
@@ -27,7 +27,7 @@ class CommandOSQuit : public Command
if (Config.GlobalOnCycle)
oper_global("", "%s", Config.GlobalOnCycleMessage.c_str());
quitting = 1;
quitting = true;
return MOD_CONT;
}
+1 -1
View File
@@ -25,7 +25,7 @@ class CommandOSReload : public Command
if (!read_config(1))
{
quitmsg = "Error during the reload of the configuration file!";
quitting = 1;
quitting = true;
}
FOREACH_MOD(I_OnReload, OnReload(false));
+4 -4
View File
@@ -72,14 +72,14 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
readonly = 1;
readonly = true;
Alog() << "Read-only mode activated";
close_log();
notice_lang(Config.s_OperServ, u, OPER_SET_READONLY_ON);
}
else if (setting.equals_ci("OFF"))
{
readonly = 0;
readonly = false;
open_log();
Alog() << "Read-only mode deactivated";
notice_lang(Config.s_OperServ, u, OPER_SET_READONLY_OFF);
@@ -219,13 +219,13 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
noexpire = 1;
noexpire = true;
Alog() << "No expire mode activated";
notice_lang(Config.s_OperServ, u, OPER_SET_NOEXPIRE_ON);
}
else if (setting.equals_ci("OFF"))
{
noexpire = 0;
noexpire = false;
Alog() << "No expire mode deactivated";
notice_lang(Config.s_OperServ, u, OPER_SET_NOEXPIRE_OFF);
}
+1 -1
View File
@@ -26,7 +26,7 @@ class CommandOSShutdown : public Command
if (Config.GlobalOnCycle)
oper_global("", "%s", Config.GlobalOnCycleMessage.c_str());
shutting_down = 1;
shutting_down = true;
return MOD_CONT;
}
+1 -1
View File
@@ -23,7 +23,7 @@ class CommandOSUpdate : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
notice_lang(Config.s_OperServ, u, OPER_UPDATING);
save_data = 1;
save_data = true;
return MOD_CONT;
}
+3 -3
View File
@@ -1004,21 +1004,21 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :m_globops is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_globops module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_servicesmod)
{
send_cmd("", "ERROR :m_services is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_hidechansmod)
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server deos not have the m_hidechans module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_svsholdmod)
+3 -3
View File
@@ -1178,21 +1178,21 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :m_globops is not loaded. This is required by Anope");
quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_servicesmod)
{
send_cmd("", "ERROR :m_services_account.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_hidechansmod)
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_svsholdmod)
+3 -3
View File
@@ -880,7 +880,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
quitting = 1;
quitting = true;
return MOD_STOP;
}
@@ -1158,14 +1158,14 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :m_services_account.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!ModeManager::FindUserModeByName(UMODE_PRIV))
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
quitting = 1;
quitting = true;
return MOD_STOP;
}
if (!has_svsholdmod)
+6 -6
View File
@@ -225,25 +225,25 @@ int init_primary(int ac, char **av)
}
if (GetCommandLineArgument("nofork", 'n'))
nofork = 1;
nofork = true;
if (GetCommandLineArgument("support", 's'))
{
nofork = nothird = 1;
nofork = nothird = true;
++debug;
}
if (GetCommandLineArgument("readonly", 'r'))
readonly = 1;
readonly = true;
if (GetCommandLineArgument("nothird"))
nothird = 1;
nothird = true;
if (GetCommandLineArgument("noexpire", 'e'))
noexpire = 1;
noexpire = true;
if (GetCommandLineArgument("protocoldebug"))
protocoldebug = 1;
protocoldebug = true;
Anope::string Arg;
if (GetCommandLineArgument("debug", 'd', Arg))
+18 -19
View File
@@ -42,13 +42,12 @@ Anope::string services_bin; /* Binary as specified by the user */
Anope::string orig_cwd; /* Original current working directory */
Anope::string log_filename = "services.log"; /* -log filename */
int debug = 0; /* -debug */
int readonly = 0; /* -readonly */
bool readonly = false; /* -readonly */
bool LogChan = false; /* -logchan */
int nofork = 0; /* -nofork */
int forceload = 0; /* -forceload */
int nothird = 0; /* -nothrid */
int noexpire = 0; /* -noexpire */
int protocoldebug = 0; /* -protocoldebug */
bool nofork = false; /* -nofork */
bool nothird = false; /* -nothrid */
bool noexpire = false; /* -noexpire */
bool protocoldebug = false; /* -protocoldebug */
Anope::string binary_dir; /* Used to store base path for Anope */
#ifdef _WIN32
@@ -57,16 +56,16 @@ Anope::string binary_dir; /* Used to store base path for Anope */
#endif
/* Set to 1 if we are to quit */
int quitting = 0;
bool quitting = false;
/* Set to 1 if we are to quit after saving databases */
int shutting_down = 0;
bool shutting_down = false;
/* Contains a message as to why services is terminating */
Anope::string quitmsg;
/* Should we update the databases now? */
int save_data = 0;
bool save_data = false;
/* At what time were we started? */
time_t start_time;
@@ -77,7 +76,7 @@ char **my_av, **my_envp;
/******** Local variables! ********/
/* Set to 1 after we've set everything up */
static int started = 0;
static bool started = false;
/*************************************************************************/
@@ -272,7 +271,7 @@ void sighandler(int signum)
if (!read_config(1))
{
quitmsg = "Error Reading Configuration File (Received SIGHUP)";
quitting = 1;
quitting = true;
}
FOREACH_MOD(I_OnReload, OnReload(true));
@@ -418,8 +417,6 @@ static bool Connect()
int main(int ac, char **av, char **envp)
{
int i;
my_av = av;
my_envp = envp;
@@ -456,7 +453,8 @@ int main(int ac, char **av, char **envp)
ModuleRunTimeDirCleanUp();
/* General initialization first */
if ((i = init_primary(ac, av)))
int i = init_primary(ac, av);
if (i)
return i;
Alog(LOG_TERMINAL) << "Anope " << Anope::Version() << ", " << Anope::Build();
@@ -467,7 +465,8 @@ int main(int ac, char **av, char **envp)
#endif
/* Initialization stuff. */
if ((i = init_secondary(ac, av)))
i = init_secondary(ac, av);
if (i)
return i;
/* If the first connect fails give up, don't sit endlessly trying to reconnect */
@@ -477,7 +476,7 @@ int main(int ac, char **av, char **envp)
ircdproto->SendConnect();
FOREACH_MOD(I_OnServerConnect, OnServerConnect());
started = 1;
started = true;
#ifndef _WIN32
if (Config.DumpCore)
@@ -515,12 +514,12 @@ int main(int ac, char **av, char **envp)
if (shutting_down)
ircdproto->SendGlobops(NULL, "Updating databases on shutdown, please wait.");
save_databases();
save_data = 0;
save_data = false;
}
if (shutting_down)
{
quitting = 1;
quitting = true;
break;
}
@@ -570,7 +569,7 @@ int main(int ac, char **av, char **envp)
if (Config.MaxRetries && j == Config.MaxRetries)
{
Alog() << "Max connection retry limit exceeded";
quitting = 1;
quitting = true;
}
}
}