#!/usr/bin/perl # 5am drunken hack :) # Abuse zeppo to make a lunatic webpage. use IO::Socket; use strict; my $debug = 0; # IRC connect/login procedure my $sock = IO::Socket::INET->new(PeerHost => "irc.taphouse.org", PeerPort => 6667) or die("connect: $!"); os("USER coder . . :I watch zeppo"); os("NICK Spy"); ### Parse loop ### while(<$sock>) { print ("IN: $_") if ($debug); s[\r\n]//g; my @in = split(/\s+/); os ("PONG $1") if (/PING :(.+)/); on_376() if ($in[1] == 376); on_privmsg($_) if ($in[1] eq "PRIVMSG"); } ### Events ### sub on_376 { os("JOIN #subgenius"); } # End of MOTD sub on_privmsg { my ($from, $cmd, $to, $msg) = split(/\s+/, $_[0], 4); return if ($from !~ /^:Zeppo!/ || /Updated:/); # Ignore weather too $msg =~ s/^://; # Strip that pesky : $msg =~ s/^.+?: //; # Zeppo replies with Nick: Msg so strip Nick: tohtml($msg) if ($from =~ /^:Zeppo!/); } # Out to the socket sub os { print $sock ("@_\n"); print("OUT: @_\n") if ($debug); } # Append to our HTML file, we open and close it each time as # there are other things that may chew on the file sub tohtml { my $msg = $_[0]; open(HTML, ">>/home/coder/www/zeppo.html"); my $fontsize = int(rand(5))+1; my $color = sprintf("%X", int(rand(0xFFFFFF))); print HTML ("$msg \n"); print HTML ("

") if (int(rand(10)) > 7); close(HTML); }