mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
SIGHUP now does /RELOAD - useful with for example /SBAR prompt DISABLE when
you don't have an input line to recover :) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2556 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
ee8229be48
commit
0d54e4e299
@ -59,6 +59,7 @@ void log_away_deinit(void);
|
||||
|
||||
int irssi_gui;
|
||||
int irssi_init_finished;
|
||||
int reload_config;
|
||||
|
||||
static char *irssi_dir, *irssi_config_file;
|
||||
static GSList *dialog_type_queue, *dialog_text_queue;
|
||||
@ -74,15 +75,20 @@ const char *get_irssi_config(void)
|
||||
return irssi_config_file;
|
||||
}
|
||||
|
||||
static void sig_reload_config(int signo)
|
||||
{
|
||||
reload_config = TRUE;
|
||||
}
|
||||
|
||||
static void read_settings(void)
|
||||
{
|
||||
#ifndef WIN32
|
||||
static int signals[] = {
|
||||
SIGHUP, SIGINT, SIGQUIT, SIGTERM,
|
||||
SIGINT, SIGQUIT, SIGTERM,
|
||||
SIGALRM, SIGUSR1, SIGUSR2
|
||||
};
|
||||
static char *signames[] = {
|
||||
"hup", "int", "quit", "term",
|
||||
"int", "quit", "term",
|
||||
"alrm", "usr1", "usr2"
|
||||
};
|
||||
|
||||
@ -95,6 +101,10 @@ static void read_settings(void)
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
|
||||
/* reload config on SIGHUP */
|
||||
act.sa_handler = sig_reload_config;
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
|
||||
for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
|
||||
act.sa_handler = find_substr(ignores, signames[n]) ?
|
||||
SIG_IGN : SIG_DFL;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
extern int irssi_gui;
|
||||
extern int irssi_init_finished; /* TRUE after "irssi init finished" signal is sent */
|
||||
extern int reload_config; /* TRUE after received SIGHUP. */
|
||||
|
||||
void core_init_paths(int argc, char *argv[]);
|
||||
|
||||
|
@ -348,6 +348,13 @@ int main(int argc, char **argv)
|
||||
can call our dirty-checker after each iteration */
|
||||
while (!quitting) {
|
||||
g_main_iteration(TRUE);
|
||||
|
||||
if (reload_config) {
|
||||
/* SIGHUP received, do /RELOAD */
|
||||
reload_config = FALSE;
|
||||
signal_emit("command reload", 1, "");
|
||||
}
|
||||
|
||||
dirty_check();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user