1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/SET beep_when_window_active + some cleanups

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1313 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-03-03 18:30:21 +00:00 committed by cras
parent fcd8810b6c
commit 46d93a3f4b
3 changed files with 16 additions and 11 deletions

View File

@ -138,10 +138,15 @@ void fe_common_core_init(void)
settings_add_bool("lookandfeel", "timestamps", TRUE); settings_add_bool("lookandfeel", "timestamps", TRUE);
settings_add_bool("lookandfeel", "msgs_timestamps", FALSE); settings_add_bool("lookandfeel", "msgs_timestamps", FALSE);
settings_add_bool("lookandfeel", "hide_text_style", FALSE); settings_add_int("lookandfeel", "timestamp_timeout", 0);
settings_add_bool("lookandfeel", "bell_beeps", FALSE); settings_add_bool("lookandfeel", "bell_beeps", FALSE);
settings_add_str("lookandfeel", "beep_msg_level", "");
settings_add_bool("lookandfeel", "beep_when_window_active", TRUE);
settings_add_bool("lookandfeel", "beep_when_away", TRUE); settings_add_bool("lookandfeel", "beep_when_away", TRUE);
settings_add_bool("lookandfeel", "hide_text_style", FALSE);
settings_add_bool("lookandfeel", "use_status_window", TRUE); settings_add_bool("lookandfeel", "use_status_window", TRUE);
settings_add_bool("lookandfeel", "use_msgs_window", FALSE); settings_add_bool("lookandfeel", "use_msgs_window", FALSE);

View File

@ -32,7 +32,7 @@ struct _FORMAT_REC {
typedef struct { typedef struct {
WINDOW_REC *window; WINDOW_REC *window;
void *server; SERVER_REC *server;
const char *target; const char *target;
int level; int level;

View File

@ -32,7 +32,7 @@
#include "fe-windows.h" #include "fe-windows.h"
#include "printtext.h" #include "printtext.h"
static int beep_msg_level, beep_when_away; static int beep_msg_level, beep_when_away, beep_when_window_active;
static int signal_gui_print_text; static int signal_gui_print_text;
static int signal_print_text_stripped; static int signal_print_text_stripped;
@ -356,11 +356,13 @@ void printtext_gui(const char *text)
g_free(str); g_free(str);
} }
static void msg_beep_check(SERVER_REC *server, int level) static void msg_beep_check(TEXT_DEST_REC *dest)
{ {
if (level != 0 && (level & MSGLEVEL_NOHILIGHT) == 0 && if (dest->level != 0 && (dest->level & MSGLEVEL_NOHILIGHT) == 0 &&
(beep_msg_level & level) && (beep_msg_level & dest->level) &&
(beep_when_away || (server != NULL && !server->usermode_away))) { (beep_when_away || (dest->server != NULL &&
!dest->server->usermode_away)) &&
(beep_when_window_active || dest->window != active_win)) {
signal_emit("beep", 0); signal_emit("beep", 0);
} }
} }
@ -372,7 +374,7 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
g_return_if_fail(dest != NULL); g_return_if_fail(dest != NULL);
g_return_if_fail(text != NULL); g_return_if_fail(text != NULL);
msg_beep_check(dest->server, dest->level); msg_beep_check(dest);
dest->window->last_line = time(NULL); dest->window->last_line = time(NULL);
format_newline(dest->window); format_newline(dest->window);
@ -421,13 +423,11 @@ static void read_settings(void)
{ {
beep_msg_level = level2bits(settings_get_str("beep_msg_level")); beep_msg_level = level2bits(settings_get_str("beep_msg_level"));
beep_when_away = settings_get_bool("beep_when_away"); beep_when_away = settings_get_bool("beep_when_away");
beep_when_window_active = settings_get_bool("beep_when_window_active");
} }
void printtext_init(void) void printtext_init(void)
{ {
settings_add_int("misc", "timestamp_timeout", 0);
settings_add_str("lookandfeel", "beep_msg_level", "");
sending_print_starting = FALSE; sending_print_starting = FALSE;
signal_gui_print_text = signal_get_uniq_id("gui print text"); signal_gui_print_text = signal_get_uniq_id("gui print text");
signal_print_text_stripped = signal_get_uniq_id("print text stripped"); signal_print_text_stripped = signal_get_uniq_id("print text stripped");