Advertisement
mrapple

Untitled

Dec 22nd, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.14 KB | None | 0 0
  1. use Irssi;
  2. use POSIX;
  3. use vars qw($VERSION %IRSSI);
  4.  
  5. $VERSION = "0.3";
  6. %IRSSI = (
  7.     authors     => "Tony Bruess",
  8.     contact     => "tony@oc.tc",
  9.     name        => "lognotice",
  10.     description => "Print hilighted messages to the console",
  11.     changed     => "July 1 2011"
  12. );
  13.  
  14. sub sig_printtext {
  15.     my ($dest, $text, $stripped) = @_;
  16.  
  17.     my $opt = MSGLEVEL_HILIGHT;
  18.  
  19.     if(Irssi::settings_get_bool('lognotice_showprivmsg')) {
  20.         $opt = MSGLEVEL_HILIGHT|MSGLEVEL_MSGS;
  21.     }
  22.    
  23.     if(($dest->{level} & ($opt)) && ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0) {
  24.         $window = Irssi::window_find_refnum('1');
  25.        
  26.         if($dest->{level} & MSGLEVEL_PUBLIC) {
  27.             $text = $dest->{target} . ": ". $text;
  28.         }
  29.  
  30.         $text = strftime(Irssi::settings_get_str('timestamp_format') . " ", localtime) . $text;
  31.         $window->print($text, MSGLEVEL_NEVER) if ($window);
  32.     }
  33. }
  34.  
  35. $window = Irssi::window_find_refnum('1');
  36.  
  37. Irssi::print("Error! Cannot find console window") if (!$window);
  38. Irssi::settings_add_bool('lognotice','lognotice_showprivmsg', 0);
  39. Irssi::signal_add('print text', 'sig_printtext');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement