diff options
| author | James Shubin | 2014-11-25 19:59:07 +0100 |
|---|---|---|
| committer | Serge van Ginderachter | 2014-11-25 21:30:13 +0100 |
| commit | a11c7830eeb4ad4f32575d87b72012ecaa4c9c98 (patch) | |
| tree | a27fcf6aa09506eb23883210da4dec26dd005979 /scripts | |
| parent | c0c61225213f664d4840fac08288a260a6e1f843 (diff) | |
| download | scripts.irssi.org-a11c7830eeb4ad4f32575d87b72012ecaa4c9c98.tar.bz2 | |
fnotify.pl: Update to version 0.0.4 by James Shubin
"Implement Consistent output formatting"
Source: https://ttboj.wordpress.com/2013/10/18/desktop-notifications-for-irssi-in-screen-through-ssh-in-gnome-terminal/
Signed-off-by: Serge van Ginderachter <serge@vanginderachter.be>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/fnotify.pl | 90 |
1 files changed, 50 insertions, 40 deletions
diff --git a/scripts/fnotify.pl b/scripts/fnotify.pl index 983a262..58b2957 100644 --- a/scripts/fnotify.pl +++ b/scripts/fnotify.pl @@ -1,68 +1,78 @@ -# todo: grap topic changes - use strict; use vars qw($VERSION %IRSSI); use Irssi; -$VERSION = '0.0.3'; +$VERSION = '0.0.4'; %IRSSI = ( - authors => 'Thorsten Leemhuis', - contact => 'fedora@leemhuis.info', - name => 'fnotify', - description => 'Write a notification to a file that shows who is talking to you in which channel.', - url => 'http://www.leemhuis.info/files/fnotify/', - license => 'GNU General Public License', - changed => '$Date: 2007-01-13 12:00:00 +0100 (Sat, 13 Jan 2007) $' + name => 'fnotify', + authors => 'Thorsten Leemhuis, James Shubin', + description => 'Write notifications to a file in a consistent format.', + license => 'GNU General Public License', ); -#-------------------------------------------------------------------- -# In parts based on knotify.pl 0.1.1 by Hugo Haas +# +# README +# +# To use: +# $ cp fnotify.pl ~/.irssi/scripts/fnotify.pl +# irssi> /load perl +# irssi> /script load fnotify +# + +# +# AUTHORS +# +# Consistent output formatting by James Shubin: +# https://ttboj.wordpress.com/ +# +# Modified from the Thorsten Leemhuis <fedora@leemhuis.info> version: +# http://www.leemhuis.info/files/fnotify/fnotify +# +# 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 +# +# 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 +# Other parts based on notify.pl from Luke Macken: # http://fedora.feedjack.org/user/918/ # -#-------------------------------------------------------------------- - -#-------------------------------------------------------------------- -# Private message parsing -#-------------------------------------------------------------------- +# +# catch private messages +# sub priv_msg { - my ($server,$msg,$nick,$address,$target) = @_; - filewrite($nick." " .$msg ); + my ($server, $msg, $nick, $address, $target) = @_; + my $network = $server->{tag}; + filewrite('' . $network . ' ' . $nick . ' ' . $msg); } -#-------------------------------------------------------------------- -# Printing hilight's -#-------------------------------------------------------------------- - +# +# catch 'hilight's +# sub hilight { - my ($dest, $text, $stripped) = @_; - if ($dest->{level} & MSGLEVEL_HILIGHT) { - filewrite($dest->{target}. " " .$stripped ); - } + my ($dest, $text, $stripped) = @_; + if ($dest->{level} & MSGLEVEL_HILIGHT) { + my $server = $dest->{server}; + my $network = $server->{tag}; + filewrite($network . ' ' . $dest->{target} . ' ' . $stripped); + } } -#-------------------------------------------------------------------- -# The actual printing -#-------------------------------------------------------------------- - +# +# write to file +# sub filewrite { my ($text) = @_; # FIXME: there is probably a better way to get the irssi-dir... - open(FILE,">>$ENV{HOME}/.irssi/fnotify"); + open(FILE, ">>$ENV{HOME}/.irssi/fnotify"); print FILE $text . "\n"; - close (FILE); + close(FILE); } -#-------------------------------------------------------------------- -# Irssi::signal_add_last / Irssi::command_bind -#-------------------------------------------------------------------- - +# +# irssi signals +# Irssi::signal_add_last("message private", "priv_msg"); Irssi::signal_add_last("print text", "hilight"); -#- end |
