summaryrefslogtreecommitdiffstats
path: root/scripts/beep.pl
blob: 0bc5c5375231e2db8f1d3709bb1e04503e949922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# $Id: beep.pl,v 1.9 2002/07/04 13:18:02 jylefort Exp $

use strict;
use Irssi 20020121.2020 ();
use vars qw($VERSION %IRSSI);
$VERSION = "1.01";
%IRSSI = (
	  authors     => 'Jean-Yves Lefort',
	  contact     => 'jylefort\@brutele.be, decadix on IRCNet',
	  name        => 'beep',
	  description => 'Replaces your terminal bell by a command specified via /set; adds a beep_when_not_away setting',
	  license     => 'BSD',
	  url         => 'http://void.adminz.be/irssi.shtml',
	  changed     => '$Date: 2002/07/04 13:18:02 $ ',
);

# /set's:
#
#	beep_when_not_away	opposite of builtin beep_when_away
#
#	beep_command		if not empty, the specified command will be
#				executed instead of the normal terminal bell
# changes:
#
#	2002-07-04	release 1.01
#			* signal_add's uses a reference instead of a string
#
#	2002-04-25	release 1.00
#			* increased version number
#
#	2002-01-24	initial release

sub beep {
  my $server = Irssi::active_server;
  if ($server && ! $server->{usermode_away}
      && ! Irssi::settings_get_bool("beep_when_not_away")) {
    Irssi::signal_stop();
  } else {
    if (my $command = Irssi::settings_get_str("beep_command")) {
      system($command);
      Irssi::signal_stop();
    }
  }
}

Irssi::settings_add_bool("lookandfeel", "beep_when_not_away", 0);
Irssi::settings_add_str("misc", "beep_command",
			"esdplay ~/sound/events/beep.wav &");

Irssi::signal_add("beep", \&beep);