summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-06-03 14:27:40 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-06-03 14:27:40 +0000
commite0cba0bb71611f82434b7f061760d105423bbe09 (patch)
tree7f1d58a67896f98bddc28077c51325bc0d0423a0 /src
parent31163a2cbcf66af94976f53d4712e4b66a4e7fdc (diff)
BUILD : 1.7.10 (823) BUGS : 385 391 NOTES : Moved checks for UseTokens, UseTS6, and Numeric into protocol_module_init because they need the ircd struct, and split init() into two functions to load the protocol module for listnicks/listchans.
git-svn-id: svn://svn.anope.org/anope/trunk@823 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@576 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/config.c18
-rw-r--r--src/init.c25
-rw-r--r--src/main.c6
-rw-r--r--src/modules.c22
4 files changed, 43 insertions, 28 deletions
diff --git a/src/config.c b/src/config.c
index cea0fe267..c9d291ee3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1395,24 +1395,6 @@ int read_config(int reload)
}
/**
- * Temp. disabled, as ircd-> isnt loaded yet, so we cant check here!
- **/
-/* if (UseTokens) {
- if (!ircd->token) {
- alog("Anope does not support TOKENS for this ircd setting unsetting UseToken");
- UseTokens = 0;
- }
- }
-
- if (UseTS6 && ircd->ts6) {
- if (!Numeric) {
- error(0,
- "UseTS6 requires the setting of Numeric to be enabled.");
- retval = 0;
- }
- }*/
-
- /**
* If they try to enable any email registration option,
* make sure they have everything else they need too...
*
diff --git a/src/init.c b/src/init.c
index 33c4b3dcd..2171be697 100644
--- a/src/init.c
+++ b/src/init.c
@@ -398,12 +398,12 @@ static void write_pidfile(void)
/*************************************************************************/
-/* Overall initialization routine. Returns 0 on success, -1 on failure. */
+/* Overall initialization routines. Return 0 on success, -1 on failure. */
-int init(int ac, char **av)
+int openlog_failed = 0, openlog_errno = 0;
+
+int init_primary(int ac, char **av)
{
- int i;
- int openlog_failed = 0, openlog_errno = 0;
int started_from_term = isatty(0) && isatty(1) && isatty(2);
/* Set file creation mask and group ID. */
@@ -438,6 +438,18 @@ int init(int ac, char **av)
return -1;
}
+ /* Add IRCD Protocol Module; exit if there are errors */
+ if (protocol_module_init()) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int init_secondary(int ac, char **av)
+{
+ int i;
+ int started_from_term = isatty(0) && isatty(1) && isatty(2);
/* Add Core MSG handles */
moduleAddMsgs();
@@ -445,10 +457,6 @@ int init(int ac, char **av)
/* Parse all remaining command-line options. */
parse_options(ac, av);
- /* Add IRCD Protocol Module; exit if there are errors */
- if (protocol_module_init()) {
- return -1;
- }
#ifndef _WIN32
if (!nofork) {
if ((i = fork()) < 0) {
@@ -482,7 +490,6 @@ int init(int ac, char **av)
}
#endif
-
/* Write our PID to the PID file. */
write_pidfile();
diff --git a/src/main.c b/src/main.c
index 6300078a0..d68617aa1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -466,6 +466,10 @@ int main(int ac, char **av, char **envp)
my_av = av;
my_envp = envp;
+ /* General initialization first */
+ if ((i = init_primary(ac, av)) != 0)
+ return i;
+
/* Find program name. */
if ((progname = strrchr(av[0], '/')) != NULL)
progname++;
@@ -492,7 +496,7 @@ int main(int ac, char **av, char **envp)
}
/* Initialization stuff. */
- if ((i = init(ac, av)) != 0)
+ if ((i = init_secondary(ac, av)) != 0)
return i;
diff --git a/src/modules.c b/src/modules.c
index c721014b5..1d9fb92c7 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -121,6 +121,7 @@ int protocol_module_init(void)
{
int ret = 0;
Module *m;
+
m = createModule(IRCDModule);
mod_current_module = m;
mod_current_user = NULL;
@@ -129,6 +130,27 @@ int protocol_module_init(void)
moduleSetType(PROTOCOL);
alog("status: [%d]", ret);
mod_current_module = NULL;
+
+ /* This is really NOT the correct place to do config checks, but
+ * as we only have the ircd struct filled here, we have to over
+ * here. -GD
+ */
+ if (UseTokens && !(ircd->token)) {
+ alog("Anope does not support TOKENS for this ircd setting; unsetting UseToken");
+ UseTokens = 0;
+ }
+
+ if (UseTS6 && !(ircd->ts6)) {
+ alog("Chosen IRCd does not support TS6, unsetting UseTS6");
+ UseTS6 = 0;
+ }
+
+ /* We can assume the ircd supports TS6 here */
+ if (UseTS6 && !Numeric) {
+ error(0, "UseTS6 requires the setting of Numeric to be enabled.");
+ ret = -1;
+ }
+
return ret;
}