html/beep.pl


   1 # $Id: beep.pl,v 1.9 2002/07/04 13:18:02 jylefort Exp $
   2 
   3 use Irssi 20020121.2020 ();
   4 $VERSION = "1.01";
   5 %IRSSI = (
   6 	  authors     => 'Jean-Yves Lefort',
   7 	  contact     => 'jylefort\@brutele.be, decadix on IRCNet',
   8 	  name        => 'beep',
   9 	  description => 'Replaces your terminal bell by a command specified via /set; adds a beep_when_not_away setting',
  10 	  license     => 'BSD',
  11 	  url         => 'http://void.adminz.be/irssi.shtml',
  12 	  changed     => '$Date: 2002/07/04 13:18:02 $ ',
  13 );
  14 
  15 # /set's:
  16 #
  17 #	beep_when_not_away	opposite of builtin beep_when_away
  18 #
  19 #	beep_command		if not empty, the specified command will be
  20 #				executed instead of the normal terminal bell
  21 # changes:
  22 #
  23 #	2002-07-04	release 1.01
  24 #			* signal_add's uses a reference instead of a string
  25 #
  26 #	2002-04-25	release 1.00
  27 #			* increased version number
  28 #
  29 #	2002-01-24	initial release
  30 
  31 use strict;
  32 
  33 sub beep {
  34   my $server = Irssi::active_server;
  35   if ($server && ! $server->{usermode_away}
  36       && ! Irssi::settings_get_bool("beep_when_not_away")) {
  37     Irssi::signal_stop();
  38   } else {
  39     if (my $command = Irssi::settings_get_str("beep_command")) {
  40       system($command);
  41       Irssi::signal_stop();
  42     }
  43   }
  44 }
  45 
  46 Irssi::settings_add_bool("lookandfeel", "beep_when_not_away", 0);
  47 Irssi::settings_add_str("misc", "beep_command",
  48 			"esdplay ~/sound/events/beep.wav &");
  49 
  50 Irssi::signal_add("beep", \&beep);