summaryrefslogtreecommitdiff
path: root/kanotix-irc/skel/.weechat/perl/autoload
diff options
context:
space:
mode:
authorHolger Paradies <retabell@gmx.de>2013-12-24 10:13:21 +0100
committerHolger Paradies <retabell@gmx.de>2014-01-04 15:58:52 +0100
commit0e66b833868a6a8530045db9002c1845f242e4ac (patch)
treee4905d91781675c260cad0011db4358f163861cb /kanotix-irc/skel/.weechat/perl/autoload
parent432430a8d20a6a9845626e2ab475194a322a73dd (diff)
downloadkanotix-packages-0e66b833868a6a8530045db9002c1845f242e4ac.zip
kanotix-packages-0e66b833868a6a8530045db9002c1845f242e4ac.tar.gz
kanotix-irc-1.0.0
Diffstat (limited to 'kanotix-irc/skel/.weechat/perl/autoload')
-rwxr-xr-xkanotix-irc/skel/.weechat/perl/autoload/sound.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/kanotix-irc/skel/.weechat/perl/autoload/sound.pl b/kanotix-irc/skel/.weechat/perl/autoload/sound.pl
new file mode 100755
index 0000000..ee6749c
--- /dev/null
+++ b/kanotix-irc/skel/.weechat/perl/autoload/sound.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+## =============================================================================
+## sound.pl (c) February 2005 by FlashCode <flashcode@flashtux.org>
+## Updated on 2005-06-04 by FlashCode <flashcode@flashtux.org>
+## Perl script for WeeChat.
+##
+## Play a sound when highlighted/private msg, or for ctcp sound event
+## You have to configure $sound_cmd_highlight and $sound_cmd_ctcp below.
+## =============================================================================
+my $version = "0.2";
+my $sound_cmd_highlight = "esdplay ~/highlight_sound.wav >/dev/null 2>&1 &";
+my $sound_cmd_ctcp = "esdplay \$filename >/dev/null 2>&1 &";
+weechat::register ("Sound", $version, "", "Sound for highlights/privates & CTCP sound events");
+
+weechat::add_message_handler("PRIVMSG", "sound");
+weechat::add_command_handler ("sound", sound_cmd);
+
+sub sound
+{
+ $server = $_[0];
+ if ($_[1] =~ /(.*) PRIVMSG (.*)/)
+ {
+ my $host = $1;
+ my $msg = $2;
+ if ($host ne "localhost")
+ {
+ system($sound_cmd_highlight) if (index($msg, weechat::get_info("nick", $server)) != -1);
+ if ($msg =~ /\001SOUND ([^ ]*)\001/)
+ {
+ my $filename = $1;
+ my $command = $sound_cmd_ctcp;
+ $command =~ s/(\$\w+)/$1/gee;
+ system($command);
+ }
+ }
+ }
+ return 0;
+}
+
+sub sound_cmd
+{
+ if ($#_ == 1)
+ {
+ my $filename = $_[1].".wav";
+ my $command = $sound_cmd_ctcp;
+ $command =~ s/(\$\w+)/$1/gee;
+ system($command);
+ weechat::command("PRIVMSG ".weechat::get_info("channel")." :\001SOUND $filename\001") if (@_);
+ }
+}