Add hook for when rehash is called.

This will be used by the future alias module.
This commit is contained in:
Elizabeth Myers 2016-04-06 05:43:54 -05:00
parent 6b3e61f1f8
commit 2575a78b0e
3 changed files with 13 additions and 2 deletions

View file

@ -33,6 +33,7 @@ extern int h_privmsg_user;
extern int h_conf_read_start; extern int h_conf_read_start;
extern int h_conf_read_end; extern int h_conf_read_end;
extern int h_outbound_msgbuf; extern int h_outbound_msgbuf;
extern int h_rehash;
void init_hook(void); void init_hook(void);
int register_hook(const char *name); int register_hook(const char *name);
@ -142,4 +143,9 @@ typedef struct
int approved; int approved;
} hook_data_privmsg_user; } hook_data_privmsg_user;
typedef struct
{
bool signal;
} hook_data_rehash;
#endif #endif

View file

@ -62,6 +62,7 @@ int h_privmsg_channel;
int h_conf_read_start; int h_conf_read_start;
int h_conf_read_end; int h_conf_read_end;
int h_outbound_msgbuf; int h_outbound_msgbuf;
int h_rehash;
void void
init_hook(void) init_hook(void)
@ -84,6 +85,7 @@ init_hook(void)
h_conf_read_start = register_hook("conf_read_start"); h_conf_read_start = register_hook("conf_read_start");
h_conf_read_end = register_hook("conf_read_end"); h_conf_read_end = register_hook("conf_read_end");
h_outbound_msgbuf = register_hook("outbound_msgbuf"); h_outbound_msgbuf = register_hook("outbound_msgbuf");
h_rehash = register_hook("rehash");
} }
/* grow_hooktable() /* grow_hooktable()

View file

@ -633,13 +633,14 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf)
bool bool
rehash(bool sig) rehash(bool sig)
{ {
hook_data_rehash hdata = { sig };
if(sig) if(sig)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Got signal SIGHUP, reloading ircd conf. file"); "Got signal SIGHUP, reloading ircd conf. file");
}
rehash_authd(); rehash_authd();
/* don't close listeners until we know we can go ahead with the rehash */ /* don't close listeners until we know we can go ahead with the rehash */
read_conf_files(false); read_conf_files(false);
@ -649,6 +650,8 @@ rehash(bool sig)
rb_strlcpy(me.info, "unknown", sizeof(me.info)); rb_strlcpy(me.info, "unknown", sizeof(me.info));
open_logfiles(); open_logfiles();
call_hook(h_rehash, &hdata);
return false; return false;
} }