Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 46 lines (40 sloc) 1.107 kb
#!perl
#
# An irssi script that sends priv msgs and hilights to a socket
use strict;
use Irssi;
use IO::Socket;
sub send_to_growl {
my ($title, $msg) = @_;
my $socket = IO::Socket::INET->new(
PeerHost => "localhost",
PeerPort => 9942,
Proto => "tcp",
);
if ($socket) {
print $socket "$title\n$msg\n";
close $socket;
}
}
# This is to avoid sending more than one
# notification per "window" and per second
my %last_notification_time;
Irssi::signal_add_last('message private', sub {
my (undef, $data, $nick) = @_;
my $t = time;
if (($last_notification_time{$nick} || 0) != $t) {
send_to_growl("<$nick>", $data);
$last_notification_time{$nick} = $t;
}
});
Irssi::signal_add_last('print text', sub {
my ($dest, undef, $stripped) = @_;
if ($dest->{level} & MSGLEVEL_HILIGHT) {
my $t = time;
my $targ = $dest->{target};
if (($last_notification_time{$targ} || 0) != $t) {
send_to_growl($targ, $stripped);
$last_notification_time{$targ} = $t;
}
}
});
Jump to Line
Something went wrong with that request. Please try again.