Advertisement
tobast

Untitled

Sep 30th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.13 KB | None | 0 0
  1. # todo: grap topic changes
  2.  
  3. use strict;
  4. use vars qw($VERSION %IRSSI);
  5.  
  6. use Irssi;
  7. $VERSION = '0.0.3';
  8. %IRSSI = (
  9.         authors     => 'Thorsten Leemhuis',
  10.         contact     => '[email protected]',
  11.         name        => 'fnotify',
  12.         description => 'Write a notification to a file that shows who is talking to you in which channel.',
  13.         url         => 'http://www.leemhuis.info/files/fnotify/',
  14.         license     => 'GNU General Public License',
  15.         changed     => '$Date: 2007-01-13 12:00:00 +0100 (Sat, 13 Jan 2007) $'
  16.         );
  17.  
  18. #--------------------------------------------------------------------
  19. # In parts based on knotify.pl 0.1.1 by Hugo Haas
  20. # http://larve.net/people/hugo/2005/01/knotify.pl
  21. # which is based on osd.pl 0.3.3 by Jeroen Coekaerts, Koenraad Heijlen
  22. # http://www.irssi.org/scripts/scripts/osd.pl
  23. #
  24. # Other parts based on notify.pl from Luke Macken
  25. # http://fedora.feedjack.org/user/918/
  26. #
  27. #--------------------------------------------------------------------
  28.  
  29. #--------------------------------------------------------------------
  30. # Private message parsing
  31. #--------------------------------------------------------------------
  32.  
  33. sub priv_msg {
  34.     my ($server,$msg,$nick,$address,$target) = @_;
  35.     filewrite($nick." " .$msg );
  36. }
  37.  
  38. #--------------------------------------------------------------------
  39. # Printing hilight's
  40. #--------------------------------------------------------------------
  41.  
  42. sub hilight {
  43.     my ($dest, $text, $stripped) = @_;
  44.     if ($dest->{level} & MSGLEVEL_HILIGHT) {
  45.         filewrite($dest->{target}. " " .$stripped );
  46.     }
  47. }
  48.  
  49. #--------------------------------------------------------------------
  50. # The actual printing
  51. #--------------------------------------------------------------------
  52.  
  53. sub filewrite {
  54.     my ($text) = @_;
  55. # FIXME: there is probably a better way to get the irssi-dir...
  56.     open(FILE,">>$ENV{HOME}/.irssi/fnotify");
  57.     print FILE $text . "\n";
  58.     close (FILE);
  59. }
  60.  
  61. #--------------------------------------------------------------------
  62. # Irssi::signal_add_last / Irssi::command_bind
  63. #--------------------------------------------------------------------
  64.  
  65. Irssi::signal_add_last("message private", "priv_msg");
  66. Irssi::signal_add_last("print text", "hilight");
  67.  
  68. #- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement