]>
jfr.im git - irssi-scripts.git/blob - hilightwin.pl
2 # This script will print hilighted messages into a window called 'hilight'.
4 # Originally written by Timo Sirainen <tss@iki.fi>
5 # - Places all hilighted messages into a window called "hilight"
6 # Amended by Mark Sangster <znxster@gmail.com>
7 # - Prints a timestamp with the messages
8 # - Now allows toggling private messages to show or not.
9 # - Using formats to print (allows basic theme adjustment)
11 # This script is released in the Public Domain.
15 # /window name hilight
16 # /script load hilightwin.pl
20 # /window name hilight
22 # /statusbar topic type window
23 # /statusbar topic visible active
24 # /statusbar window_inact disable
25 # /script load hilightwin.pl
27 # Toggle private messages with:
28 # /toggle hilightwin_showprivmsg
33 use vars
qw($VERSION %IRSSI);
37 authors
=> "John Runyon",
38 contact
=> "https://github.com/zonidjan",
40 description
=> "Print arbitrary-level messages to window named \"hilight\"",
41 license
=> "Public Domain",
42 url
=> "http://github.com/zonidjan/irssi-scripts/",
43 changed
=> "2018-01-02",
46 # Setup the theme for the script
47 Irssi
::theme_register
([
48 'hilightwin_loaded', '%R>>%n %_hilightwin:%_ Version $0 by $1.',
49 'hilightwin_missing', '%R>>%n %_hilightwin:%_ No window named "hilight" was found, please create it',
50 'hilightwin_output', '$0 $1',
51 'hilightwin_public_output', '$0 $1: $2',
55 sub hilightwin_signal
{
56 my ($dest, $text, $ignored) = @_;
57 $window = Irssi
::window_find_name
('hilight');
59 # Skip if the named window doesn't exist
61 my $opt = Irssi
::settings_get_level
('hilightwin_show');
63 if( ($dest->{level
} & ($opt)) && ($dest->{level
} & MSGLEVEL_NOHILIGHT
) == 0 ) {
64 $time = strftime
( Irssi
::settings_get_str
('timestamp_format')." ", localtime );
65 if($dest->{level
} & MSGLEVEL_PUBLIC
) {
66 $window->printformat(MSGLEVEL_NEVER
, 'hilightwin_public_output', $time, $dest->{target
}, $text);
69 $window->printformat(MSGLEVEL_NEVER
, 'hilightwin_output', $time, $text);
76 Irssi
::settings_add_level
('hilightwin','hilightwin_show','HILIGHT MSGS');
79 Irssi
::signal_add
('print text', 'hilightwin_signal');
82 $window = Irssi
::window_find_name
('hilight');
83 Irssi
::printformat
(MSGLEVEL_CLIENTCRAP
, 'hilightwin_missing') if (!$window);
84 Irssi
::printformat
(MSGLEVEL_CLIENTCRAP
, 'hilightwin_loaded', $VERSION, $IRSSI{authors
});
86 # vim:set ts=4 sw=4 noet: