/usr/share/irssi/scripts/osd.pl is in irssi-scripts 20120326.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | use strict;
use IO::Handle;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '0.3.3';
%IRSSI = (
authors => 'Jeroen Coekaerts, Koenraad Heijlen',
contact => 'vipie@ulyssis.org, jeroen@coekaerts.be',
name => 'osd',
description => 'An OnScreenDisplay (osd) it show\'s who is talking to you, on what IRC Network.',
license => 'BSD',
url => 'http://vipie.studentenweb.org/dev/irssi/',
changed => '2004-01-09'
);
#--------------------------------------------------------------------
# Changelog
# 2004-01-09
# - fix a typo in the help (M.G.Kishalmi)
# TODO :
#
# * a setting that let's you display the text? (exploits?!)
#
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Public Variables
#--------------------------------------------------------------------
my %myHELP = ();
#--------------------------------------------------------------------
# Help function
#--------------------------------------------------------------------
sub cmd_help {
my ($about) = @_;
%myHELP = (
osd_test => "
osd_test
Displays a small test message on screen
",
osd_reload => "
osd_reload
Restarts the osd_cat program, it's especially need when
have CHANGED settings. They DO NOT take effect UNTIL you RELOAD.
",
osd => "
OSD
You can display on screen who is paging/msg'ing you on IRC.
When you CHANGE the settings you SHOULD use /osd_reload to let these changes
take effect.
Settings:
---------
* osd_color (default: blue)
Currently the setting is: " . Irssi::settings_get_str('osd_color') . "
It should be a valid X color, the list in normally located in /etc/X11/rgb.txt.
* osd_font (default: -*-helvetica-medium-r-\*-\*-\*-320-\*-\*-\*-\*-\*-\*)
Currently the setting is: " . Irssi::settings_get_str('osd_font') . "
These fonts are available when you installed the microsoft font pack :-)
-microsoft-tahoma-bold-r-normal-*-\*-320-\*-\*-p-\*-\*-\*
-microsoft-verdana-bold-r-normal-\*-\*-320-\*-\*-p-\*-\*-\*
This font is available on every linux install with the adobe fonts.
-*-helvetica-medium-r-\*-\*-\*-320-\*-\*-\*-\*-\*-\*
* osd_align (default: right)
Currently the setting is: " . Irssi::settings_get_str('osd_align') . "
left|right|center (horizontal alignment)
* osd_place (default: top)
Currently the setting is: " . Irssi::settings_get_str('osd_place') . "
top|bottom|middle (vertical alginment)
* osd_offset (default: 100)
Currently the setting is: " . Irssi::settings_get_str('osd_offset') . "
The vertical offset from the screen edge set in osd_place.
* osd_indent (default: 100)
Currently the setting is: " . Irssi::settings_get_str('osd_indent') . "
The horizontal offset from the screen edge set in osd_align.
* osd_shadow (default: 0)
Currently the setting is: " . Irssi::settings_get_str('osd_shadow') . "
Set the shadow offset, if the offset is 0, the shadow is disabled.
* osd_delay (default: 4)
Currently the setting is: " . Irssi::settings_get_str('osd_delay') . "
How many seconds should the message remain on screen.
* osd_age (default: 4)
Currently the setting is: " . Irssi::settings_get_str('osd_age') . "
Time in seconds before old scroll lines are discarded.
* osd_lines (default: 5)
Currently the setting is: " . Irssi::settings_get_str('osd_lines') . "
Number of lines to display on screen at one time.
* osd_DISPLAY (default: :0.0)
Currently the setting is: " . Irssi::settings_get_str('osd_DISPLAY') . "
On what \$DISPLAY should the osd connect. (this makes tunneling possible)
* osd_showactivechannel (default: yes)
Currently the setting is: " . Irssi::settings_get_str('osd_showactivechannel') . "
When set to yes, OSD will be triggered even if the channel is the active channel.
When set to yes, OSD will be triggered if you send a message from your own nick.
You can test the OSD settings with the 'osd_test' command!
he 'osd_test' to test them.
",
);
if ( $about =~ /(osd_reload|osd_test|osd)/i ) {
Irssi::print($myHELP{lc($1)});
}
}
#--------------------------------------------------------------------
# Irssi::Settings
#--------------------------------------------------------------------
Irssi::settings_add_str('OSD', 'osd_color', "blue");
#These fonts are available when you installed the microsoft font pack :-)
#Irssi::settings_add_str('OSD', 'osd_font', "-microsoft-tahoma-bold-r-normal-\*-\*-320-\*-\*-p-\*-\*-\*");
#Irssi::settings_add_str('OSD', 'osd_font', "-microsoft-verdana-bold-r-normal-\*-\*-320-\*-\*-p-\*-\*-\*");
#This font is available on every linux install with the adobe fonts.
Irssi::settings_add_str('OSD', 'osd_font', "-*-helvetica-medium-r-\*-\*-\*-320-\*-\*-\*-\*-\*-\*");
Irssi::settings_add_str('OSD', 'osd_age', "4");
Irssi::settings_add_str('OSD', 'osd_align', "right");
Irssi::settings_add_str('OSD', 'osd_delay', "4");
Irssi::settings_add_str('OSD', 'osd_indent', "100");
Irssi::settings_add_str('OSD', 'osd_lines', "5");
Irssi::settings_add_str('OSD', 'osd_offset', "100");
Irssi::settings_add_str('OSD', 'osd_place', "top");
Irssi::settings_add_str('OSD', 'osd_shadow', "0");
Irssi::settings_add_str('OSD', 'osd_DISPLAY', ":0.0");
Irssi::settings_add_str('OSD', 'osd_showactivechannel', "yes");
#--------------------------------------------------------------------
# initialize the pipe, test it.
#--------------------------------------------------------------------
sub init {
pipe_open();
osdprint("OSD Loaded.");
}
#--------------------------------------------------------------------
# open the OSD pipe
#--------------------------------------------------------------------
sub pipe_open {
my $place;
my $version;
my $command;
$version = `osd_cat -h 2>&1` or die("The OSD program can't be started, check if you have osd_cat installed AND in your path.");
$version =~ /Version:\s*(.*)\s*/;
$version = $1;
#Irssi::print "Version: $version";
if ( $version =~ /^2.*/ ) {
# the --pos argument seems to be broken on 2.0.X
if ( Irssi::settings_get_str('osd_place') eq "top" ) {
$place = "-p top";
} elsif ( Irssi::settings_get_str('osd_place') eq "bottom") {
$place = "-p bottom";
} else {
$place = "-p middle";
}
} else {
if ( Irssi::settings_get_str('osd_place') eq "top" ) {
$place = "--top";
} else {
$place = "--bottom";
}
}
$command = "|DISPLAY=".Irssi::settings_get_str('osd_display') .
" osd_cat $place " .
" --color=".Irssi::settings_get_str('osd_color').
" --delay=".Irssi::settings_get_str('osd_delay').
" --age=".Irssi::settings_get_str('osd_age').
" --font=".quotemeta(Irssi::settings_get_str('osd_font')).
" --offset=".Irssi::settings_get_str('osd_offset').
" --shadow=".Irssi::settings_get_str('osd_shadow').
" --lines=".Irssi::settings_get_str('osd_lines').
" --align=".Irssi::settings_get_str('osd_align');
if ( $version =~ /^2.*/ ) {
$command .= " --indent=".Irssi::settings_get_str('osd_indent');
}
open( OSDPIPE, $command )
or print "The OSD program can't be started, check if you have osd_cat installed AND in your path.";
OSDPIPE->autoflush(1);
}
#--------------------------------------------------------------------
# Private message parsing
#--------------------------------------------------------------------
sub priv_msg {
my ($server,$msg,$nick,$address,$target) = @_;
if ((Irssi::settings_get_str('osd_showactivechannel') =~ /yes/) or
not (Irssi::active_win()->get_active_name() eq "$nick") ) {
osdprint($server->{chatnet}.":$nick");
}
}
#--------------------------------------------------------------------
# Public message parsing
#--------------------------------------------------------------------
sub pub_msg {
my ($server,$msg,$nick,$address, $channel) = @_;
my $show;
if (Irssi::settings_get_str('osd_showactivechannel') =~ /yes/) {
$show = 1;
} elsif(uc(Irssi::active_win()->get_active_name()) eq uc($channel)) {
$show = 0;
}
if ($show) {
my $onick= quotemeta "$server->{nick}";
my $pat ='(\:|\,|\s)'; # option...
if($msg =~ /^$onick\s*$pat/i){
osdprint("$channel".":$nick");
}
}
}
#--------------------------------------------------------------------
# The actual printing
#--------------------------------------------------------------------
sub osdprint {
my ($text) = @_;
if (not (OSDPIPE->opened())) {pipe_open();}
print OSDPIPE "$text\n";
OSDPIPE->flush();
}
#--------------------------------------------------------------------
# A test command.
#--------------------------------------------------------------------
sub cmd_osd_test {
osdprint("Testing OSD");
}
#--------------------------------------------------------------------
# A command to close and reopen OSDPIPE
# so options take effect without needing to unload/reload the script
#--------------------------------------------------------------------
sub cmd_osd_reload {
close(OSDPIPE);
pipe_open();
osdprint("Reloaded OSD");
}
#--------------------------------------------------------------------
# Irssi::signal_add_last / Irssi::command_bind
#--------------------------------------------------------------------
Irssi::signal_add_last("message public", "pub_msg");
Irssi::signal_add_last("message private", "priv_msg");
Irssi::command_bind("osd_reload","cmd_osd_reload", "OSD");
Irssi::command_bind("osd_test","cmd_osd_test", "OSD");
Irssi::command_bind("help","cmd_help", "Irssi commands");
#--------------------------------------------------------------------
# The command that's executed at load time.
#--------------------------------------------------------------------
init();
#--------------------------------------------------------------------
# This text is printed at Load time.
#--------------------------------------------------------------------
Irssi::print("Use /help osd for more information.");
#- end
|