#!/usr/bin/perl -w # sends growlnotify over ssh on irssi messages use strict; use vars qw($VERSION %IRSSI); use Irssi; # user@host my $to = "XXXX\@192.168.1.100"; $VERSION = '0.02'; %IRSSI = ( authors => '31d1', contact => '31d1@31d1.com', name => 'grssh', description => 'growlnotify for irssi over ssh', license => 'BSD', url => 'http://growl.info/', ); sub message_public () { my ($server, $data, $nick, $address, $chan) = @_; # we don't know shit about escaping, so we'll discard almost everything $data =~ s/[^A-Za-z0-9,\. ]//g; my $cmd = 'growlnotify -m \"'.$data.'\" \"'.$nick.'@'.$chan.'\"'; system("ssh $to $cmd 2>/dev/null &"); } sub message_private () { my ($server, $data, $nick, $address, $chan) = @_; # yes, we learned it the hard way $data =~ s/[^A-Za-z0-9,\. ]//g; my $cmd = 'growlnotify -m \"'.$data.'\" msg\ from\ \"'.$nick.'\"'; system("ssh $to $cmd 2>/dev/null &"); } Irssi::signal_add_last('message public', \&message_public); Irssi::signal_add_last('message private', \&message_private); Irssi::print($IRSSI{name}.' '.$VERSION.' loaded');