summaryrefslogtreecommitdiff
path: root/src/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.c')
-rw-r--r--src/init.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/init.c b/src/init.c
index e8e13d862..c6daf5918 100644
--- a/src/init.c
+++ b/src/init.c
@@ -607,11 +607,6 @@ int init(int ac, char **av)
lang_init();
if (debug)
alog("debug: Loaded languages");
-
- /* Initialize remote database support */
- rdb_init();
- if (debug)
- alog("debug: Loaded remote databases");
/* Initialize subservices */
ns_init();
@@ -622,6 +617,10 @@ int init(int ac, char **av)
hostserv_init();
helpserv_init();
+#ifdef USE_RDB
+ rdb_init();
+#endif
+
/* Initialize proxy detection */
#ifdef USE_THREADS
if (ProxyDetect && !proxy_init()) {
@@ -644,6 +643,12 @@ int init(int ac, char **av)
#endif
/* Load up databases */
+#ifdef USE_RDB
+ if (UseRDB)
+ rdb_load_dbases();
+ /* Need a better way to handle this -dane */
+ if (!UseRDB) {
+#endif
if (!skeleton) {
load_ns_dbase();
if (debug)
@@ -677,8 +682,25 @@ int init(int ac, char **av)
if (debug)
alog("debug: Loaded PreNick database (9/9)");
}
+#ifdef USE_RDB
+ }
+#endif
alog("Databases loaded");
- save_databases();
+
+ /* Save the databases back to file/mysql to reflect any changes */
+#ifdef USE_RDB
+ if (!UseRDB) { /* Only save if we are not using remote databases
+ * to avoid floods. As a side effects our nice
+ * FFF databases won't get overwritten if the
+ * mysql db is broken (empty etc.) */
+#endif
+ alog("Info: Reflecting database records.");
+ save_databases();
+#ifdef USE_RDB
+ } else {
+ alog("Info: Not reflecting database records.");
+ }
+#endif
/* Make myself known to myself in the serverlist */
me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME);