summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorflashcode <flashcode@krypton>2008-04-28 17:48:49 +0200
committerflashcode <flashcode@krypton>2008-04-28 17:48:49 +0200
commit81558fe7cb2c0a7d00b93eae9baebc62b49ba28a (patch)
treeae644eb0af093d667159d28eab990ea1d48f43d5 /src
parentd32893ec417ffdfd4532aa07e1e262d9652c83a1 (diff)
downloadweechat-81558fe7cb2c0a7d00b93eae9baebc62b49ba28a.zip
Send quit signal when terminal is lost (clean quit: disconnect from servers, ..)
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-keyboard.c6
-rw-r--r--src/gui/curses/gui-curses-main.c9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c
index 154fb2dbf..74131aa7a 100644
--- a/src/gui/curses/gui-curses-keyboard.c
+++ b/src/gui/curses/gui-curses-keyboard.c
@@ -30,6 +30,8 @@
#include "../../core/weechat.h"
#include "../../core/wee-config.h"
+#include "../../core/wee-hook.h"
+#include "../../core/wee-log.h"
#include "../../core/wee-utf8.h"
#include "../../core/wee-string.h"
#include "../../plugins/plugin.h"
@@ -351,6 +353,8 @@ gui_keyboard_read_cb (void *data)
if (ret == 0)
{
/* no data on stdin, terminal lost */
+ log_printf (_("Terminal lost, exiting WeeChat..."));
+ hook_signal_send ("quit", WEECHAT_HOOK_SIGNAL_STRING, NULL);
quit_weechat = 1;
return WEECHAT_RC_OK;
}
@@ -371,6 +375,8 @@ gui_keyboard_read_cb (void *data)
if (ret == 0)
{
/* no data on stdin, terminal lost */
+ log_printf (_("Terminal lost, exiting WeeChat..."));
+ hook_signal_send ("quit", WEECHAT_HOOK_SIGNAL_STRING, NULL);
quit_weechat = 1;
return WEECHAT_RC_OK;
}
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index 2933ddec6..5a9976ca4 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -160,8 +160,9 @@ gui_main_init ()
void
gui_main_signal_sigquit ()
{
- log_printf (_("Signal %s received, quitting WeeChat..."),
+ log_printf (_("Signal %s received, exiting WeeChat..."),
"SIGQUIT");
+ hook_signal_send ("quit", WEECHAT_HOOK_SIGNAL_STRING, NULL);
quit_weechat = 1;
}
@@ -172,8 +173,9 @@ gui_main_signal_sigquit ()
void
gui_main_signal_sigterm ()
{
- log_printf (_("Signal %s received, quitting WeeChat..."),
+ log_printf (_("Signal %s received, exiting WeeChat..."),
"SIGTERM");
+ hook_signal_send ("quit", WEECHAT_HOOK_SIGNAL_STRING, NULL);
quit_weechat = 1;
}
@@ -184,7 +186,6 @@ gui_main_signal_sigterm ()
void
gui_main_signal_sighup ()
{
- log_printf (_("Signal SIGHUP received, reloading configuration files"));
gui_reload_config = 1;
}
@@ -235,6 +236,8 @@ gui_main_loop ()
if (gui_reload_config)
{
gui_reload_config = 0;
+ log_printf (_("Signal SIGHUP received, reloading configuration "
+ "files"));
command_reload (NULL, NULL, 0, NULL, NULL);
}