1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 09:13:14 +02:00

Send quit signal when terminal is lost (clean quit: disconnect from servers, ..)

This commit is contained in:
flashcode
2008-04-28 17:48:49 +02:00
parent d32893ec41
commit 81558fe7cb
9 changed files with 107 additions and 42 deletions
+6
View File
@@ -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;
}
+6 -3
View File
@@ -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);
}