renames, add irssi scripts
[shutils.git] / dotfiles / irssi / scripts / hilightwin.pl
1 #
2 # Print hilighted messages & private messages to window named "hilight" for
3 # irssi 0.7.99 by Timo Sirainen
4 #
5 # Modded a tiny bit by znx to stop private messages entering the hilighted
6 # window (can be toggled) and to put up a timestamp.
7 #
8
9 use Irssi;
10 use POSIX;
11 use vars qw($VERSION %IRSSI);
12
13 $VERSION = "0.02";
14 %IRSSI = (
15 authors => "Timo \'cras\' Sirainen, Mark \'znx\' Sangster",
16 contact => "tss\@iki.fi, znxster\@gmail.com",
17 name => "hilightwin",
18 description => "Print hilighted messages to window named \"hilight\"",
19 license => "Public Domain",
20 url => "http://irssi.org/",
21 changed => "Sun May 25 18:59:57 BST 2008"
22 );
23
24 sub sig_printtext {
25 my ($dest, $text, $stripped) = @_;
26
27 my $opt = MSGLEVEL_HILIGHT;
28
29 if(Irssi::settings_get_bool('hilightwin_showprivmsg')) {
30 $opt = MSGLEVEL_HILIGHT|MSGLEVEL_MSGS;
31 }
32
33 if(
34 ($dest->{level} & ($opt)) &&
35 ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0
36 ) {
37 $window = Irssi::window_find_name('hilight');
38
39 if ($dest->{level} & MSGLEVEL_PUBLIC) {
40 $text = $dest->{target}.": ".$text;
41 }
42 $text = strftime(
43 Irssi::settings_get_str('timestamp_format')." ",
44 localtime
45 ).$text;
46 $window->print($text, MSGLEVEL_NEVER) if ($window);
47 }
48 }
49
50 $window = Irssi::window_find_name('hilight');
51 Irssi::print("Create a window named 'hilight'") if (!$window);
52
53 Irssi::settings_add_bool('hilightwin','hilightwin_showprivmsg',1);
54
55 Irssi::signal_add('print text', 'sig_printtext');
56
57 # vim:set ts=4 sw=4 et: