From 2575a78b0e5a4c58849a4a7f9bcce0d6b970db6d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 6 Apr 2016 05:43:54 -0500 Subject: [PATCH] Add hook for when rehash is called. This will be used by the future alias module. --- include/hook.h | 6 ++++++ ircd/hook.c | 2 ++ ircd/s_conf.c | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/hook.h b/include/hook.h index 0198ae7b..72cc9fdd 100644 --- a/include/hook.h +++ b/include/hook.h @@ -33,6 +33,7 @@ extern int h_privmsg_user; extern int h_conf_read_start; extern int h_conf_read_end; extern int h_outbound_msgbuf; +extern int h_rehash; void init_hook(void); int register_hook(const char *name); @@ -142,4 +143,9 @@ typedef struct int approved; } hook_data_privmsg_user; +typedef struct +{ + bool signal; +} hook_data_rehash; + #endif diff --git a/ircd/hook.c b/ircd/hook.c index dfb7a1f9..a15afdd0 100644 --- a/ircd/hook.c +++ b/ircd/hook.c @@ -62,6 +62,7 @@ int h_privmsg_channel; int h_conf_read_start; int h_conf_read_end; int h_outbound_msgbuf; +int h_rehash; void init_hook(void) @@ -84,6 +85,7 @@ init_hook(void) h_conf_read_start = register_hook("conf_read_start"); h_conf_read_end = register_hook("conf_read_end"); h_outbound_msgbuf = register_hook("outbound_msgbuf"); + h_rehash = register_hook("rehash"); } /* grow_hooktable() diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 19ea9fd0..36f336a4 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -633,13 +633,14 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf) bool rehash(bool sig) { + hook_data_rehash hdata = { sig }; + if(sig) - { sendto_realops_snomask(SNO_GENERAL, L_ALL, "Got signal SIGHUP, reloading ircd conf. file"); - } rehash_authd(); + /* don't close listeners until we know we can go ahead with the rehash */ read_conf_files(false); @@ -649,6 +650,8 @@ rehash(bool sig) rb_strlcpy(me.info, "unknown", sizeof(me.info)); open_logfiles(); + + call_hook(h_rehash, &hdata); return false; }