#!/usr/bin/perl use strict; use warnings; use File::Spec (); BEGIN { use lib File::Spec->catdir( Xchat::get_info('xchatdir'), 'lib' ); } use N0i::Xchat::OSD; my $osd = N0i::Xchat::OSD->new( ### CHANGE YOUR SETTINGS AS YOU WISH # plugin on/off on => 1, # how many lines to display? size => 2, # after how many idle seconds should OSD window dissapear? timeout => 6, # after how many seconds to expire messages in queue? expires => 60, # OSD Position: # top: 0, middle: 2, bottom: 1 position => 0, # left: 0, center: 1, right: 2 align => 0, horizontal_offset => 5, vertical_offset => 10, # OSD Aspect: # font => '-microsoft-georgia-medium-r-normal-*-18-*-*-*-p-*-iso10646-1', font => '-b&h-luxi serif-medium-r-normal-*-14-*-*-*-p-*-iso10646-1', color => '#3F3', outline => '#333', outline_offset => 2, shadow_offset => 1, # show public chatter pubmsg => 1, # show private messages privmsg => 1, # show NOTICE notice => 0, # show ACTIONs action => 1, # show JOINs join => 1, # show PARTs part => 1, # show QUITs quit => 1, # show CTCP stuff ctcp => 1, # BEEP on/off beep => 1, # BEEP command # beepcmd => '/usr/bin/artsplay /usr/share/sounds/gaim/redalert.wav', beepcmd => '/usr/bin/aplay /usr/share/sounds/gaim/redalert.wav', # IRC Server (AND current XChat version) triggers a "+" or "-" before messages? # ^ "identified" vs "unidentified" user uident => 1, # ignore unidentified users? ignore_unidentified => 0, ## IGNORE stuff... # - this is a fucking Regular Expression !! ignore_target => qr/^(?i: #.*?(?i:warez|music|mp3).* | (?i:helminthe|razvan|redcom)_* )$/ox, ############################################################################### # That should be all you needed editing. # Place this script into your ~/.xchat2 directory and fire xchat up. # Enjoy. ############################################################################### ) or die "Fucked up. :(\n"; sub help { Xchat::print($_.$/) foreach split /\n/, < - how many lines to display? \x02timeout\x02 <\x02seconds\x02> - after how many idle seconds should OSD window dissapear? \x02expires\x02 <\x02seconds\x02> - after how many seconds to expire messages in queue? \x02position\x02 <\x02position\x02> - OSD display position: 0 - top, 1 - bottom, 2 - middle \x02align\x02 <\x02align\x02> - OSD display alignment: 0 - left, 1 - center, 2 - right \x02font\x02 <\x02font\x02> - OSD display font \x02color\x02 <\x02color\x02> - OSD display foreground color \x02outline\x02 <\x02color\x02> - OSD display outline color \x02outline_offset\x02 <\x02pixels\x02> - OSD display outline offset \x02shadow_offset\x02 <\x02pixels\x02> - OSD display shadow offset \cC11SPECIAL\cO: \x02uident\x02 - handle "identified" vs "unidentified" users? \x02ignore_unidentified\x02 - ignore unidentified users? \x02ignore_target\x02 <\x02RegExp\x02> - What targets to ignore \x02beepcmd\x02 <\x02SystemCommand\x02> - What command (+args) to use for beeping EOF } sub print_result { my ($rc, @messages) = @_; if (@messages) { my $prefix = $rc ? '' : "\x02ERROR\x02: "; Xchat::print("$prefix$_\n") for (@messages); } Xchat::EAT_NONE; } sub command_handler { if (!$_[1]->[1] || $_[1]->[1] =~ /^\s*help\s*/i || $_[1]->[1] =~ /^\s*$/) { help(); } else { print_result $osd->command_handler($_[1]->[1]); } Xchat::EAT_ALL; } $osd->register; $osd->set_hooks( [ 'server', 'PRIVMSG', sub { print_result $osd->privmsg_handler($_[1]->[0]); Xchat::EAT_NONE; } ], [ 'server', 'NOTICE', sub { print_result $osd->privmsg_handler($_[1]->[0]); Xchat::EAT_NONE; } ], [ 'command', 'osd', sub { if (!$_[1]->[1] || $_[1]->[1] =~ /^\s*help\s*/i || $_[1]->[1] =~ /^\s*$/) { help(); } else { print_result $osd->command_handler($_[1]->[1]); } Xchat::EAT_ALL; }, { help_text => 'type "/osd help"' } ] ); $osd->loaded;