Hi,

This patch against irssi trunk r5217 makes irssi not emit a beep if the source
of the beep is part of the activity_hide_targets setting.

So far, it seems to work for my limited test case (after putting myself into the
activity_hide_targets list and sending myself a message, irssi stops beeping and
after I remove my nick from the list, it starts beeping and displaying window
activity again).


Best regards,

Moritz


Index: src/fe-common/core/printtext.c
===================================================================
--- src/fe-common/core/printtext.c      (revision 5217)
+++ src/fe-common/core/printtext.c      (working copy)
@@ -32,6 +32,8 @@
 #include "fe-windows.h"
 #include "printtext.h"
 
+#include "window-activity.h" /* target_is_hidden() */
+
 static int beep_msg_level, beep_when_away, beep_when_window_active;
 
 static int signal_gui_print_text_finished;
@@ -407,7 +409,8 @@
 
 static void msg_beep_check(TEXT_DEST_REC *dest)
 {
-       if (dest->level != 0 && (dest->level & MSGLEVEL_NO_ACT) == 0 &&
+       if (dest->level != 0 && !target_is_hidden(dest) && 
+           (dest->level & MSGLEVEL_NO_ACT) == 0 &&
            (beep_msg_level & dest->level) &&
            (beep_when_away || (dest->server != NULL &&
                                !dest->server->usermode_away)) &&
Index: src/fe-common/core/window-activity.c
===================================================================
--- src/fe-common/core/window-activity.c        (revision 5217)
+++ src/fe-common/core/window-activity.c        (working copy)
@@ -70,6 +70,12 @@
                    GINT_TO_POINTER(old_data_level));
 }
 
+int target_is_hidden(TEXT_DEST_REC *dest)
+{
+       return hide_targets && dest && dest->target &&
+               strarray_find_dest(hide_targets, dest);
+}
+
 static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
 {
        WI_ITEM_REC *item;
Index: src/fe-common/core/window-activity.h
===================================================================
--- src/fe-common/core/window-activity.h        (revision 5217)
+++ src/fe-common/core/window-activity.h        (working copy)
@@ -9,5 +9,6 @@
 
 void window_activity_init(void);
 void window_activity_deinit(void);
+int target_is_hidden(TEXT_DEST_REC *dest);
 
 #endif

Reply via email to