Created
September 27, 2011 19:07
-
-
Save anewusername1/1245924 to your computer and use it in GitHub Desktop.
irssi growl notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use vars qw($VERSION %IRSSI); | |
use Irssi; | |
$VERSION = '0.0.1'; | |
%IRSSI = ( | |
authors => 'Tracey Eubanks', | |
contact => '[email protected]', | |
name => 'growlme', | |
description => "Send growl notifications when you receive a pm or you're mentioned in a channel", | |
url => 'http://narshlob.github.com', | |
license => 'GNU General Public License', | |
changed => '$Date: 2011-09-26 12:00:00 +0100 (Tue, 26 Sep 2011) $' | |
); | |
#-------------------------------------------------------------------- | |
# mostly base on what was found at http://www.leemhuis.info/files/fnotify/fnotify | |
#-------------------------------------------------------------------- | |
#-------------------------------------------------------------------- | |
# Private message parsing | |
#-------------------------------------------------------------------- | |
sub priv_msg { | |
my ($server,$msg,$nick,$address,$target) = @_; | |
$msg =~ s/["';]//g; | |
system("growlnotify -t '".$nick."' -m '".$msg."'"); | |
} | |
#-------------------------------------------------------------------- | |
# Printing hilight's | |
#-------------------------------------------------------------------- | |
sub hilight { | |
my ($dest, $text, $stripped) = @_; | |
if ($dest->{level} & MSGLEVEL_HILIGHT) { | |
$stripped =~ s/["';]//g; | |
system("growlnotify -t 'Message on ".$dest->{target}."' -m '".$stripped."'"); | |
} | |
} | |
#-------------------------------------------------------------------- | |
# Irssi::signal_add_last / Irssi::command_bind | |
#-------------------------------------------------------------------- | |
Irssi::signal_add_last("message private", "priv_msg"); | |
Irssi::signal_add_last("print text", "hilight"); | |
#- end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment