# SMS Notification when someone talks to you and you're away # Based on http://www.leemhuis.info/files/fnotify/fnotify # Modified by f6k for personal use (2016-12-23) # With help of https://irssinotifier.appspot.com/script/irssinotifier.pl use strict; use vars qw($VERSION %IRSSI); use Irssi; $VERSION = '0.0.1'; %IRSSI = ( authors => 'Thorsten Leemhuis', contact => 'fedora@leemhuis.info', name => 'smsnotify', description => 'Send a notification by SMS that shows who is talking to you in which channel.', url => 'http://www.leemhuis.info/files/fnotify/', license => 'GNU General Public License', changed => '$Date: 2016-12-23 12:00:00 +0100 (Fri, 23 Dec 2016) $' ); #-------------------------------------------------------------------- # In parts based on knotify.pl 0.1.1 by Hugo Haas # http://larve.net/people/hugo/2005/01/knotify.pl # which is based on osd.pl 0.3.3 by Jeroen Coekaerts, Koenraad Heijlen # http://www.irssi.org/scripts/scripts/osd.pl # # Other parts based on notify.pl from Luke Macken # http://fedora.feedjack.org/user/918/ # #-------------------------------------------------------------------- # Using an other script to send notification, need to know where $ENV{PATH} = "/home/f6k/g/scripts"; #-------------------------------------------------------------------- # Private message parsing #-------------------------------------------------------------------- sub priv_msg { my ($server,$msg,$nick,$address,$target) = @_; sendnotification($nick." " .$msg ); } #-------------------------------------------------------------------- # Printing hilight's #-------------------------------------------------------------------- sub hilight { my ($dest, $text, $stripped) = @_; if ($dest->{level} & MSGLEVEL_HILIGHT) { sendnotification($dest->{target}. " " .$stripped ); } } #-------------------------------------------------------------------- # The actual notification #-------------------------------------------------------------------- sub sendnotification { my ($text) = @_; system("free-sms.sh", "shyla irssi highlight: ", $text); } #-------------------------------------------------------------------- # Irssi::signal_add_last / Irssi::command_bind #-------------------------------------------------------------------- Irssi::signal_add_last("message private", "priv_msg"); Irssi::signal_add_last("print text", "hilight"); #- end