#!/usr/bin/perl -w # # This script is a quick hack of aol.tar.gz to spew random quotes from the "fortune" program (required, not included) # Usage: copy this script into ~/.xchat , or, type /load fortune.pl # to use, just type /fortune # Other Examples of use: # Offensive fortunes: /fortune -o # specific database: /fortune database # Please send all questions/comments/mods to mishari@siamrelay.com # # -=This hack is dedicated to Leila, the only love of my life=- $exec = "/usr/games/fortune"; IRC::add_command_handler("fortune", "fortune_say"); sub fortune_say { my $commandline = shift(@_); open(READ,"$exec -s $commandline|"); $total_fortune=0; while() { $total_fortune++; chop; push @fortune,$_; } close(READ); $rand = 0; $mynick = IRC::get_info(1); $channel = IRC::get_info(2); while($rand<$total_fortune){ IRC::send_raw "PRIVMSG $channel :$fortune[$rand]\n"; IRC::print "<$mynick> $fortune[$rand]\n"; $rand++; } while(@fortune){ pop(@fortune); } return 1; }