summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-03-10 15:20:44 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-03-10 15:20:44 +0000
commit0d54e4e299b78916a12411f6e4e80dd3cf420bde (patch)
tree314b73b1df71d193a6e286e090ef609869d068cc /src
parentee8229be487df091882166d4c6a64d13caf02f4a (diff)
downloadirssi-0d54e4e299b78916a12411f6e4e80dd3cf420bde.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/core/core.c14
-rw-r--r--src/core/core.h1
-rw-r--r--src/fe-text/irssi.c9
3 files changed, 21 insertions, 3 deletions
diff --git a/src/core/core.c b/src/core/core.c
index 041d75a4..b11064cb 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -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;
diff --git a/src/core/core.h b/src/core/core.h
index 6b7ec621..74317166 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -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[]);
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index 76ab2d74..ca1d735b 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -348,7 +348,14 @@ int main(int argc, char **argv)
can call our dirty-checker after each iteration */
while (!quitting) {
g_main_iteration(TRUE);
- dirty_check();
+
+ if (reload_config) {
+ /* SIGHUP received, do /RELOAD */
+ reload_config = FALSE;
+ signal_emit("command reload", 1, "");
+ }
+
+ dirty_check();
}
g_main_destroy(main_loop);