From 8c94585f7704151e36b8aceb599b05b1ac1b49df Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 9 Apr 2004 22:18:21 +0000 Subject: [PATCH] Fix service persistence bug in patch-47 patch-47 attempted to fix a previously reported error where srvx would create NickServ, ChanServ, OpServ and Global even if the "nick" entry was omitted from srvx.conf. This broke persistence of all service bots added by the modcmd.service\ add comand. (Closes: #932566) git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-48 --- ChangeLog | 16 ++++++++++++++++ src/modcmd.c | 14 +++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89a969e..29394eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,22 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3 # +2004-04-09 22:18:21 GMT Michael Poole patch-48 + + Summary: + Fix service persistence bug in patch-47 + Revision: + srvx--devo--1.3--patch-48 + + patch-47 attempted to fix a previously reported error where srvx would + create NickServ, ChanServ, OpServ and Global even if the "nick" entry + was omitted from srvx.conf. This broke persistence of all service + bots added by the modcmd.service\ add comand. (Closes: #932566) + + modified files: + ChangeLog src/modcmd.c + + 2004-04-09 20:08:58 GMT Michael Poole patch-47 Summary: diff --git a/src/modcmd.c b/src/modcmd.c index 027c06f..ba5f40e 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -2024,7 +2024,7 @@ modcmd_expand(const char *variable) { } static void -modcmd_load_bots(struct dict *db) { +modcmd_load_bots(struct dict *db, int default_nick) { dict_iterator_t it; for (it = dict_first(db); it; it = iter_next(it)) { @@ -2038,8 +2038,12 @@ modcmd_load_bots(struct dict *db) { continue; } nick = database_get_data(rd->d.object, "nick", RECDB_QSTRING); - if (!nick) - continue; + if (!nick) { + if (default_nick) + nick = iter_key(it); + else + continue; + } svc = service_find(nick); desc = database_get_data(rd->d.object, "description", RECDB_QSTRING); hostname = database_get_data(rd->d.object, "hostname", RECDB_QSTRING); @@ -2060,7 +2064,7 @@ modcmd_load_bots(struct dict *db) { static void modcmd_conf_read(void) { - modcmd_load_bots(conf_get_data("services", RECDB_OBJECT)); + modcmd_load_bots(conf_get_data("services", RECDB_OBJECT), 0); } void @@ -2204,7 +2208,7 @@ modcmd_saxdb_read(struct dict *db) { struct record_data *rd, *rd2; struct service *service; - modcmd_load_bots(database_get_data(db, "bots", RECDB_OBJECT)); + modcmd_load_bots(database_get_data(db, "bots", RECDB_OBJECT), 1); db2 = database_get_data(db, "services", RECDB_OBJECT); if (!db2) { log_module(MAIN_LOG, LOG_ERROR, "Missing section 'services' in modcmd db."); -- 2.20.1