]> jfr.im git - solanum.git/blobdiff - ircd/ircd.c
Merge branch 'master' of github.com:charybdis-ircd/charybdis
[solanum.git] / ircd / ircd.c
index 96dcbce42d1c026b6332ccaa6982875e64894ee8..432931deeaef6226732bc8c5a14857529af057ea 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id$
  */
 
-#include "ratbox_lib.h"
+#include "rb_lib.h"
 #include "stdinc.h"
 #include "setup.h"
 #include "config.h"
@@ -41,7 +39,6 @@
 #include "hostmask.h"
 #include "numeric.h"
 #include "parse.h"
-#include "res.h"
 #include "restart.h"
 #include "s_auth.h"
 #include "s_conf.h"
@@ -68,6 +65,8 @@
 #include "chmode.h"
 #include "privilege.h"
 #include "bandbi.h"
+#include "authd.h"
+#include "operhash.h"
 
 /* /quote set variables */
 struct SetOptions GlobalSetOptions;
@@ -100,14 +99,14 @@ const char *logFileName = LPATH;
 const char *pidFileName = PPATH;
 
 char **myargv;
-int dorehash = 0;
-int dorehashbans = 0;
-int doremotd = 0;
-int kline_queued = 0;
-int server_state_foreground = 0;
-int opers_see_all_users = 0;
-int ssl_ok = 0;
-int zlib_ok = 1;
+bool dorehash = false;
+bool dorehashbans = false;
+bool doremotd = false;
+bool kline_queued = false;
+bool server_state_foreground = false;
+bool opers_see_all_users = false;
+bool ssl_ok = false;
+bool zlib_ok = true;
 
 int testing_conf = 0;
 time_t startup_time;
@@ -279,13 +278,13 @@ check_rehash(void *unused)
        if(dorehash)
        {
                rehash(1);
-               dorehash = 0;
+               dorehash = false;
        }
 
        if(dorehashbans)
        {
                rehash_bans(1);
-               dorehashbans = 0;
+               dorehashbans = false;
        }
 
        if(doremotd)
@@ -293,7 +292,7 @@ check_rehash(void *unused)
                sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                     "Got signal SIGUSR1, reloading ircd motd file");
                cache_user_motd();
-               doremotd = 0;
+               doremotd = false;
        }
 }
 
@@ -376,7 +375,7 @@ write_pidfile(const char *filename)
        {
                unsigned int pid = (unsigned int) getpid();
 
-               rb_snprintf(buff, sizeof(buff), "%u\n", pid);
+               snprintf(buff, sizeof(buff), "%u\n", pid);
                if((fputs(buff, fb) == -1))
                {
                        ilog(L_MAIN, "Error writing %u to pid file %s (%s)",
@@ -449,13 +448,13 @@ setup_corefile(void)
 static void
 ircd_log_cb(const char *str)
 {
-       ilog(L_MAIN, "libratbox reports: %s", str);
+       ilog(L_MAIN, "librb reports: %s", str);
 }
 
 static void
 ircd_restart_cb(const char *str)
 {
-       inotice("libratbox has called the restart callback: %s", str);
+       inotice("librb has called the restart callback: %s", str);
        restart(str);
 }
 
@@ -472,11 +471,11 @@ ircd_die_cb(const char *str)
        if(str != NULL)
        {
                /* Try to get the message out to currently logged in operators. */
-               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "libratbox has called the die callback..aborting: %s", str);
-               inotice("libratbox has called the die callback..aborting: %s", str);
+               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "librb has called the die callback..aborting: %s", str);
+               inotice("librb has called the die callback..aborting: %s", str);
        }
        else
-               inotice("libratbox has called the die callback..aborting");
+               inotice("librb has called the die callback..aborting");
 
        unlink(pidFileName);
        exit(EXIT_FAILURE);
@@ -571,6 +570,9 @@ charybdis_main(int argc, char *argv[])
         */
        setup_corefile();
 
+       /* initialise operhash fairly early. */
+       init_operhash();
+
        memset(&me, 0, sizeof(me));
        memset(&meLocalUser, 0, sizeof(meLocalUser));
        me.localClient = &meLocalUser;
@@ -603,7 +605,7 @@ charybdis_main(int argc, char *argv[])
        setup_signals();
 
        if (testing_conf)
-               server_state_foreground = 1;
+               server_state_foreground = true;
 
        /* Make sure fd 0, 1 and 2 are in use -- jilles */
        do
@@ -649,7 +651,7 @@ charybdis_main(int argc, char *argv[])
        init_hook();
        init_channels();
        initclass();
-       initwhowas();
+       whowas_init();
        init_reject();
        init_cache();
        init_monitor();
@@ -660,12 +662,14 @@ charybdis_main(int argc, char *argv[])
        load_core_modules(1);
 
        init_auth();            /* Initialise the auth code */
-       init_resolver();        /* Needs to be setup before the io loop */
+       init_authd();           /* Start up authd. */
+       init_dns();             /* Start up DNS query system */
+
        privilegeset_set_new("default", "", 0);
 
        if (testing_conf)
                fprintf(stderr, "\nBeginning config test\n");
-       read_conf_files(YES);   /* cold start init conf files */
+       read_conf_files(true);  /* cold start init conf files */
 
        mod_add_path(MODULE_DIR);
        mod_add_path(MODULE_DIR "/autoload");
@@ -709,10 +713,10 @@ charybdis_main(int argc, char *argv[])
                if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list))
                {
                        ilog(L_MAIN, "WARNING: Unable to setup SSL.");
-                       ssl_ok = 0;
+                       ssl_ok = false;
                }
                else
-                       ssl_ok = 1;
+                       ssl_ok = true;
        }
 
        if (testing_conf)