From 81558fe7cb2c0a7d00b93eae9baebc62b49ba28a Mon Sep 17 00:00:00 2001 From: flashcode Date: Mon, 28 Apr 2008 17:48:49 +0200 Subject: Send quit signal when terminal is lost (clean quit: disconnect from servers, ..) --- src/gui/curses/gui-curses-keyboard.c | 6 ++++++ src/gui/curses/gui-curses-main.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3