After a 10-year hiatus, I'm back on IRC (irc.cplug.net). EricAndreychek kept mentioning that's how the locals get a quorum together to do stuff, so I installed irssi because I like ncurses and extensibility (I used to use BitchX but it lacks clean extensibility; and I didn't use WeeChat because irssi has a larger user base (although weechat has extensibility support for languages other than perl)).

I need discrete (discontinous, as opposed to prudent ;) alerts, so I altered Thorstenl's notification script to handle better notification logging:

use Irssi qw{}; $VERSION = '0.0.3'; %IRSSI = ( authors => 'Thorsten Leemhuis', contact => 'fedora@leemhuis.info', name => 'fnotify', description => 'Write a notification to a file that shows who is talking to you in which channel.', url => 'http://www.leemhuis.info/files/fnotify/', license => 'GNU General Public License', changed => '$Date: 2007-01-13 12:00:00 +0100 (Sat, 13 Jan 2007) $' ); Irssi::settings_add_str( 'fnotify', 'fnotify_file', sprintf("%s/.irssi/fnotify.log", $ENV{'HOME'}) ); #-------------------------------------------------------------------- # In parts based on knotify.pl 0.1.1 by Hugo Haas # http://larve.net/people/hugo/2005/01/knotify.pl # which is based on osd.pl 0.3.3 by Jeroen Coekaerts, Koenraad Heijlen # http://www.irssi.org/scripts/scripts/osd.pl # # Other parts based on notify.pl from Luke Macken # http://fedora.feedjack.org/user/918/ # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # Private message parsing #-------------------------------------------------------------------- sub priv_msg { my ($server,$msg,$nick,$address,$target) = @_; filewrite($nick." " .$msg ); } #-------------------------------------------------------------------- # Printing hilight's #-------------------------------------------------------------------- sub hilight { my ($dest, $text, $stripped) = @_; if ($dest->{level} & MSGLEVEL_HILIGHT) { filewrite($dest->{target}. " " .$stripped ); } } #-------------------------------------------------------------------- # The actual printing #-------------------------------------------------------------------- sub filewrite { my ($text) = @_; # FIXME: there is probably a better way to get the irssi-dir... open my $fh, ">>" . Irssi::settings_get_str('fnotify_file') ; print $fh $text . "\n"; close $fh; } # # rm the message # sub cleanup { unlink Irssi::settings_get_str('fnotify_file'); } #-------------------------------------------------------------------- # Irssi::signal_add_last / Irssi::command_bind #-------------------------------------------------------------------- Irssi::signal_add_last("message private", "priv_msg"); Irssi::signal_add_last("print text", "hilight"); Irssi::command_bind fnotify_clear => \&cleanup;
and on the back-end, I have a message monitoring script that just drops to OSD.
%mailboxes = ( "inbox" => "/home/phaller/.maildir/new/.", "rss" => "/home/phaller/.maildir/rss/new/.", "lists" => "/home/phaller/.maildir/lists/new/.", ); $irc = "/home/phaller/.irssi/fnotify.log"; my $cmd = sub { return join ' ', "echo '" , @_ , "' | osd_cat -p bottom -A center -o -45 -c black"; # return join ' ', "echo '" , @_ , "' | osd_cat -o 3 -i 500 -c black"; # return join ' ', "ratpoison -c 'echo '" . @_ , "'"; }; while ( 1 ) { run() } sub run { my $line = ""; for (keys %mailboxes) { $line .= mail_count($_, $mailboxes{$_}); } $line .= irc_count($irc); $line ne "" and system $cmd->($line); } sub irc_count { my ($file) = @_; open my $fh, $file; my @lines = <$fh>; close $fh; scalar(@lines) == 0 and return; return sprintf("irc(%d)", scalar(@lines)); } sub mail_count { my ($title, $dir) = @_; opendir my $dh, $dir; my @cnt = grep { ! /^\.\.?$/ } readdir $dh; closedir $dh; scalar @cnt == 0 and return; return sprintf("%s(%d) ", $title, scalar(@cnt)); }

I started something similar a while ago and never finished it. I used POE::Session::Irssi though. I liked the cleaness of the code it produced and it seemed easy to work with. http://nathanpowell.org/blog/archives/176 -- Nathan