From bdf968e11a69234fe3323940d4a9a91c55b0d72c Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 29 Apr 2006 15:17:39 +0000 Subject: [PATCH] - Made it so me::numeric can be changed (when not linked to any servers) so no server restart is needed anymore (#0002896). --- Changes | 2 ++ src/s_conf.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index e1d2c5425..8692897c3 100644 --- a/Changes +++ b/Changes @@ -1161,3 +1161,5 @@ - Updated sendnotice() so it sends a proper notice if the user is in pre-connect stage. - Fixed bug with chinese-* charsets not getting detected properly by config parser. Reported and patch provided by Xuefer (#0002891). +- Made it so me::numeric can be changed (when not linked to any servers) so no server restart + is needed anymore (#0002896). diff --git a/src/s_conf.c b/src/s_conf.c index 921b52757..54a803ac5 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1602,6 +1602,38 @@ ConfigItem_log *ca = MyMallocEx(sizeof(ConfigItem_log)); AddListItem(ca, conf_log); } +int isanyserverlinked(void) +{ +int i; +aClient *acptr; + + for (i = LastSlot; i >= 0; i--) + if ((acptr = local[i]) && (acptr != &me) && IsServer(acptr)) + return 1; + + return 0; +} + +void applymeblock(void) +{ + if (!conf_me || !me.serv) + return; /* uh-huh? */ + + /* Numeric change? */ + if (conf_me->numeric != me.serv->numeric) + { + /* Can we apply ? */ + if (!isanyserverlinked()) + { + me.serv->numeric = conf_me->numeric; + } else { + config_warn("me::numeric: Numeric change detected, but change cannot be applied " + "due to being linked to other servers. Unlink all servers and /REHASH to " + "try again."); + } + } +} + int init_conf(char *rootconf, int rehash) { config_status("Loading IRCd configuration .."); @@ -1681,7 +1713,7 @@ int init_conf(char *rootconf, int rehash) abort(); } charsys_finish(); - + applymeblock(); } else {