[I'm not subscribed to this list - CC any replies.]

The attached patch adds a new set, set beep_cmd.  Iff set, the value
of this variable will be evaled instead of calling the standard
term_beep function whenever epic wants to beep at the user.
Suggested documentation:

Synposis:
    set beep_cmd [<beep command>]

Description:
    If this variable is set, its contents will be evaluated instead 
    of calling the standard beep routine when a beep needs to be 
    output.

See Also:
    beep(4); set(4) beep_max, beep_on_msg, beep_when_away


(The contents of, at least, beep(4) should be amended to mention this 
set.)

-- 
Matthew Sachs   <[EMAIL PROTECTED]>  <[EMAIL PROTECTED]>
http://www.zevils.com/ * GPG key: 0x600A0342 * PGP key: 0x93EA1151
#The original nonstandard deviant# (((T^E)%(PQ))^D)%(PQ) = RSA-NOP
diff -ur epic4.orig/include/ircaux.h epic4/include/ircaux.h
--- epic4.orig/include/ircaux.h Wed Jan  9 21:26:30 2002
+++ epic4/include/ircaux.h      Mon Jan 28 15:29:46 2002
@@ -158,6 +158,7 @@
 const char *   find_forward_quote      (const char *, const char *);
 const char *   find_backward_quote     (const char *, const char *);
 const char *   my_strerror             (int);
+void   do_beep                 (void);
 
 /* From words.c */
 #define SOS            -32767
diff -ur epic4.orig/include/vars.h epic4/include/vars.h
--- epic4.orig/include/vars.h   Fri Jan 25 16:57:09 2002
+++ epic4/include/vars.h        Mon Jan 28 15:27:44 2002
@@ -25,6 +25,7 @@
        BANNER_VAR,
        BANNER_EXPAND_VAR,
        BEEP_VAR,
+       BEEP_CMD_VAR,
        BEEP_MAX_VAR,
        BEEP_ON_MSG_VAR,
        BEEP_WHEN_AWAY_VAR,
diff -ur epic4.orig/source/commands.c epic4/source/commands.c
--- epic4.orig/source/commands.c        Mon Jan 28 14:23:13 2002
+++ epic4/source/commands.c     Mon Jan 28 15:34:17 2002
@@ -3138,14 +3138,14 @@
                                        new_free((char **)&aliases);
                                }
                                if (!*buffer)
-                                       term_beep();
+                                       do_beep();
                        }
                }
                else
-                       term_beep();
+                       do_beep();
        }
        else
-               term_beep();
+               do_beep();
 
        new_free(&line);
 }
diff -ur epic4.orig/source/ircaux.c epic4/source/ircaux.c
--- epic4.orig/source/ircaux.c  Mon Jan 28 14:23:14 2002
+++ epic4/source/ircaux.c       Mon Jan 28 15:34:24 2002
@@ -1474,7 +1474,7 @@
                i;
 
        for (cnt = beeps, i = 0; i < cnt; i++)
-               term_beep();
+               do_beep();
 }
 
 /* Not really complicated, but a handy function to have */
@@ -3775,5 +3775,18 @@
 #endif
        }
        return strerror(errno);
+}
+
+void           do_beep (void)
+{
+       char *beepcmd;
+
+       if (get_int_var(BEEP_VAR) && global_beep_ok)
+       {
+               if((beepcmd = get_string_var(BEEP_CMD_VAR)))
+                       parse_line((char *) 0, beepcmd, empty_string, 0, 0);  
+               else
+                       term_beep();
+       }
 }
 
diff -ur epic4.orig/source/screen.c epic4/source/screen.c
--- epic4.orig/source/screen.c  Mon Jan 28 14:23:15 2002
+++ epic4/source/screen.c       Mon Jan 28 15:34:32 2002
@@ -1988,7 +1988,7 @@
        if (output)
        {
                if (beep)
-                       term_beep();
+                       do_beep();
                if (clreol)
                        term_clear_to_eol();
        }
@@ -2263,7 +2263,7 @@
                if (window->beep_always && strchr(str, '\007'))
                {
                        Window *old_to_window;
-                       term_beep();
+                       do_beep();
                        old_to_window = to_window;
                        to_window = current_window;
                        say("Beep in window %d", window->refnum);
diff -ur epic4.orig/source/vars.c epic4/source/vars.c
--- epic4.orig/source/vars.c    Fri Jan 25 16:57:10 2002
+++ epic4/source/vars.c Mon Jan 28 15:32:37 2002
@@ -98,6 +98,7 @@
        { "BANNER",                     STR_TYPE_VAR,   0, NULL, NULL, 0, 0 },
        { "BANNER_EXPAND",              BOOL_TYPE_VAR,  0, NULL, NULL, 0, 0 },
        { "BEEP",                       BOOL_TYPE_VAR,  DEFAULT_BEEP, NULL, NULL, 0, 0 
},
+       { "BEEP_CMD",                   STR_TYPE_VAR,   0, NULL, NULL, 0, 0 },
        { "BEEP_MAX",                   INT_TYPE_VAR,   DEFAULT_BEEP_MAX, NULL, NULL, 
0, 0 },
        { "BEEP_ON_MSG",                STR_TYPE_VAR,   0, NULL, set_beep_on_msg, 0, 0 
},
        { "BEEP_WHEN_AWAY",             INT_TYPE_VAR,   DEFAULT_BEEP_WHEN_AWAY, NULL, 
NULL, 0, 0 },
@@ -300,6 +301,7 @@
                        panic("Variable [%d] (%s) is out of order.", i, 
irc_variable[i].name);
 
        set_string_var(BANNER_VAR, DEFAULT_BANNER);
+       set_string_var(BEEP_CMD_VAR, NULL);
        set_string_var(BEEP_ON_MSG_VAR, DEFAULT_BEEP_ON_MSG);
        set_string_var(CMDCHARS_VAR, DEFAULT_CMDCHARS);
        set_string_var(CURRENT_WINDOW_LEVEL_VAR, DEFAULT_CURRENT_WINDOW_LEVEL);
diff -ur epic4.orig/source/window.c epic4/source/window.c
--- epic4.orig/source/window.c  Mon Jan 28 14:23:16 2002
+++ epic4/source/window.c       Mon Jan 28 15:34:54 2002
@@ -4651,7 +4651,7 @@
 
        if (new_top == window->top_of_scrollback)
        {
-               term_beep();
+               do_beep();
                return;
        }
 
@@ -4682,7 +4682,7 @@
 
        if (new_top == window->display_ip || !window->scrollback_point)
        {
-               term_beep();
+               do_beep();
                return;
        }
 
@@ -4742,7 +4742,7 @@
 
        if (!window->scrollback_point)
        {
-               term_beep();
+               do_beep();
                return;
        }
 
@@ -4764,7 +4764,7 @@
 
        if (window->display_buffer_size <= window->display_size)
        {
-               term_beep();
+               do_beep();
                return;
        }
 

Reply via email to