diff --git a/src/core/settings.c b/src/core/settings.c index 04c7bbe6..28f953ba 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -138,6 +138,23 @@ int settings_get_level(const char *key) return str == NULL ? 0 : level2bits(str, NULL); } +int settings_get_level_negative(const char *key) +{ + const char *str, *tmp, *all_levels; + int levels; + + str = settings_get_str_type(key, SETTING_TYPE_LEVEL); + if (str == NULL) + return 0; + + all_levels = bits2level(~0); + tmp = g_strdup_printf("%s %s", all_levels, str); + levels = level2bits(tmp, NULL) ^ level2bits(all_levels, NULL); + g_free((char *) tmp); + g_free((char *) all_levels); + return levels; +} + int settings_get_size(const char *key) { const char *str; diff --git a/src/core/settings.h b/src/core/settings.h index 3a8a4646..9c78b3db 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -66,6 +66,7 @@ int settings_get_int(const char *key); int settings_get_bool(const char *key); int settings_get_time(const char *key); /* as milliseconds */ int settings_get_level(const char *key); +int settings_get_level_negative(const char *key); int settings_get_size(const char *key); /* as bytes */ int settings_get_choice(const char *key); char *settings_get_print(SETTINGS_REC *rec); diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 6869fba3..18652689 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -32,13 +32,14 @@ #include #include -static int beep_msg_level, beep_when_away, beep_when_window_active; +static int beep_msg_level, beep_msg_level_ignore, beep_when_away, beep_when_window_active; static int signal_gui_print_text_finished; static int signal_print_starting; static int signal_print_text; static int signal_print_format; static int signal_print_noformat; +static int signal_window_hilight_check; static int sending_print_starting; @@ -404,7 +405,18 @@ static void msg_beep_check(TEXT_DEST_REC *dest) (beep_when_away || (dest->server != NULL && !dest->server->usermode_away)) && (beep_when_window_active || dest->window != active_win)) { - signal_emit("beep", 0); + if (beep_msg_level_ignore & MSGLEVEL_HIDDEN) { + int cb_ignore = 0; + if (signal_emit_id(signal_window_hilight_check, 4, dest, NULL, NULL, + &cb_ignore), + cb_ignore) { + return; + } + } else if (beep_msg_level_ignore & dest->level) { + return; + } + + signal_emit("beep", 0); } } @@ -521,6 +533,7 @@ static void sig_gui_dialog(const char *type, const char *text) static void read_settings(void) { beep_msg_level = settings_get_level("beep_msg_level"); + beep_msg_level_ignore = settings_get_level_negative("beep_msg_level"); beep_when_away = settings_get_bool("beep_when_away"); beep_when_window_active = settings_get_bool("beep_when_window_active"); } @@ -533,6 +546,7 @@ void printtext_init(void) signal_print_text = signal_get_uniq_id("print text"); signal_print_format = signal_get_uniq_id("print format"); signal_print_noformat = signal_get_uniq_id("print noformat"); + signal_window_hilight_check = signal_get_uniq_id("window hilight check"); read_settings(); signal_add("print text", (SIGNAL_FUNC) sig_print_text); diff --git a/src/perl/common/Settings.xs b/src/perl/common/Settings.xs index 20596c86..2da23400 100644 --- a/src/perl/common/Settings.xs +++ b/src/perl/common/Settings.xs @@ -96,6 +96,10 @@ int settings_get_level(key) char *key +int +settings_get_level_negative(key) + char *key + int settings_get_size(key) char *key