#!/bin/sh
# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# perlserver ircclient.pl

echo x - perlserver
sed -e 's/^X//' > "perlserver" << '//E*O*F perlserver//'
X#!/util/bin/perl						#CONFIGURE
X
X# local defines
X
X$OPERPASSFILE = './pw';						#CONFIGURE
X
X# variables:
X#    $port, $server    - server to connect to
X#    $servername       - name of the server we're on
X#                        (what the server calls itself)
X#    $nick             - nickname
X#    $fullname         - full name field
X#    $username         - username to use with server
X#    S                 - socket file handle
X#    $source           - source of a remote message
X#    $quitflag         - set to 1 to quit
X#    $owner            - my owner
X#    $magicword        - how do you make me leave?
X#    $eavesdrop        - forward MSGs to owner
X#    $Debug            - debugging mode
X#    $talk             - like stuff a lot
X#    $guard            - act as a guardian
X#    %lastpriv         - last msg from whoever
X
X# primitive support functions
X
Xsub Upcase {			# upcase the arg & return it
X    local($string) =@_;
X    $string =~ tr/a-z/A-Z/;
X    $string;
X}
X
Xsub StripLeadingColon {		# strips the leading colon if any from $arg
X    local($string) = @_;	# and returns the str without the :
X    $string =~ s/^://;		# (written because IRC has so many :msgs)
X    $string;
X}
X# cmdline parsing now uses getopt.pl for ease of expansion
X
Xpush(@INC,'.');
Xrequire 'getopts.pl';
Xrequire 'ircclient.pl';
X
Xdo Getopts('p:s:n:f:u:O:c:m:d:k:L:D:oevgrl');
X# port, server, nick, fullname, username, Debug, revenge
X# Owner, channel, magicword, delay, kill target, Log file
X# Booleans: o = oper, e = eavesdrop,
X# g = guard, l = logging
X
X@mnth=("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
X($sec,$min,$hour,$date,$month,$year,$rest)=localtime();
X$month = @mnth[$month];
X$date = "0".$date if ($date < 10);
X$hour = "0".$hour if ($hour < 10);
X$min = "0".$min if ($min < 10);
X$sec = "0".$sec if ($sec < 10);
X$started = "$date-$month-$year at $hour:$min:$sec";
X
X$fullname = $opt_f || $ENV{'IRCAUTONAME'} || 'What's My Line?';	#CONFIGURE
X$nick = $opt_n || $ENV{'IRCAUTONICK'} || "NICK_GOES_HERE";	#CONFIGURE
X$owner = $opt_O || $ENV{'USER'} || (getpwuid($<))[0] || die "Ooops";
X$port = $opt_p || $ENV{'IRCPORT'} || 6667;
X$server = $opt_s || $ENV{'IRCSERVER'} || 'SOME_SERVER';		#CONFIGURE
X$username = $opt_u || $nick;
X
X$channel = $opt_c || "##";					#CONFIGURE
X$debug = $opt_D || 0;
X$delay = $opt_d || 1;
X$kickveng = 0;
X$log = $opt_l;
X$logfile = $opt_L || "log";
X$magicword = $opt_m || 'MAGIC_WORD_GOES_HERE';			#CONFIGURE
X$reply = "does ch-op and invite.";				#CONFIGURE
X$secret = "PASSWORD";						#CONFIGURE
X$tries = "1";
X$vengeance = $opt_r || 0;
X
X$WhoisUnlocked = 1;						#XXX
X
X$eavesdrop = $opt_e;
X$guard = $opt_g;
X$wantinvite = "";
X$original_nick = $nick;
X
Xforeach $i (@seed) {};
X
Xopen(LOG, ">>$logfile") if ($logfile);
Xopen(DLOG, ">>D$logfile") if ($logfile);
Xselect(LOG); $| = 1; select(STDOUT); $| = 1;
X
Xif ($opt_o || $opt_k) {
X    chop($operpass = `head -1 $OPERPASSFILE`);
X}
X
X# connect to server
X&ircclient'bindsocket('S',$server,$port);
X
X# first, signon as a client
X&SignOn();
X&ircclient'join($channel);
X
X# next, completely ignore the message of the day
X# while getting the server's name for itself
X
X# munchmotd:
X#    while (<S>) {
X#	chop;
X#	($servername) = m/.*Your host is ([^ ,]+),.*/
X#	    if m/Your host is/;
X#	if (( m!End of /MOTD command! ) ||
X#	    ( m!Message-of-today is missing! )) {
X#	    last munchmotd;
X#	}
X#}
X
X$servername = $server unless $servername; # do some simple trapping for oldies
X
X#&ircclient'away();
X$help = "help message";
X
X mainloop:
X    while (<S>) {
X	chop;
X	$_ = ":$servername $_" unless /^:/;
X	($source, $command, $parms) = split(/ /,$_,3);
X	$source = &StripLeadingColon($source);
X	$cmd = &Upcase($command);
X      cmdcase:			# treated as a switch/case type thingy
X	{			# as long as you're careful about eq
X	    if ($cmd eq '311') {&SetWhois($parms); last cmdcase;};
X	    if ($cmd eq '312') {&SetWherefrom($parms); last cmdcase;};
X	    if ($cmd eq '313') {&SetOperStat($source,$cmd,$parms);
X	                        last cmdcase;};
X	    if ($cmd eq '318') {$WhoisUnlocked = 1; last cmdcase;};
X	    if ($cmd eq '351') {&ParseVersion(); last cmdcase;};
X	    if ($cmd eq '364') {&ParseLinks(); last cmdcase;};
X	    if ($cmd eq '365') {&ParseLinkEnd(); last cmdcase;};
X	    if ($cmd eq '433') {&SetNick(); &SignOn(); last cmdcase;};
X	    if ($cmd eq '461') {&SetOper(); last cmdcase;};
X	    if ($cmd eq 'CHANNEL') {&ParseChan($source,$cmd,$parms);
X				    last cmdcase;};
X	    if ($cmd eq 'INVITE') {&ParseInvite($source,$parms);
X				   last cmdcase;};
X	    if ($cmd eq 'JOIN') {&ParseChan($source,$cmd,$parms);
X	    			 last cmdcase;};
X	    if ($cmd eq 'KICK') {&ParseKick($source,$parms); last cmdcase;};
X	    if ($cmd eq 'KILL') {&ParseKill($source); last cmdcase;};
X	    if ($cmd eq 'MODE') {&ParseMode($source,$cmd,$parms);
X				 last cmdcase;};
X	    if ($cmd eq 'MSG') {&ParseMsg($source,$parms);
X				last cmdcase;};
X	    if ($cmd eq 'NOTICE') {&ParseNotice($source,$parms);
X				   last cmdcase;};
X	    if ($cmd eq 'PART') {&ParseChan($source,$cmd,$parms);
X				 last cmdcase;};
X	    if ($cmd eq 'PING') {&ircclient'pong($nick);
X				 last cmdcase;};
X	    if ($cmd eq 'PRIVMSG') {&ParsePriv($source,$parms);
X				    last cmdcase;};
X	    if ($cmd eq 'QUIT') {&ParseQuit($source,$cmd,$parms);
X				 last cmdcase;};
X	    if ($cmd eq 'WALL') {&ParseWall($source,$parms);
X				last cmdcase;};
X	    if ($cmd eq 'WALLOPS') {&ParseWallop($source,$parms);
X				last cmdcase;};
X	    if ($cmd eq 'WHOREPLY') {&ParseWhoreply($parms);
X				 last cmdcase;};
X	}	    
X	    
X    } continue {
X	if ($PendingWhois && $WhoisUnlocked) {
X	    &ircclient'whois($PendingWhois);
X	    $PendingWhois = "";
X	}
X	if ($quitflag) {&Quit;}
X    }
X
Xif ($gotme) {
X    close(LOG);
X    open(OPPED, ">>opped");
X    print (OPPED "@opped\n");
X    close(OPPED);
X    $delay += 5;
X    sleep $delay;
X    if (!fork()){
X      exec("./tzoserv -d $delay -k $gotme -n $nick -o -l -L $logfile -s $server -c $channel") if ($vengeance);
X      exec("./tzoserv -d $delay -n $nick -o -l -L $logfile -s $server -c $channel");
X    }
X}
X
Xsub ParseCTCP{
X    local($src, $args) = @_;
X    local($err) = $args;
X    $err =~ s///g;
X    &ircclient'notice($src,
X        "FINGER Idle 0 seconds, on since $started.")	#CONFIGURE
X        if ($args =~ /FINGER.+/);
X    &ircclient'notice($src, "USERINFO This is a program.")
X        if ($args =~ /USERINFO.+/);
X    &ircclient'notice($src,
X                      "VERSION BUPerlbot pjg 3 3 Perl :BUPerlbot.pjg.3.3 Perl original code ckd, this version pjg")
X        if ($args =~ /VERSION.+/);
X    &ircclient'notice($src, "ERRMSG Nothing is wrong.")
X        if ($args =~ /ERRMSG/);
X    &ircclient'notice($src, "ERRMSG $err Nothing is wrong.")
X        if ($args =~ /ERRMSG.+/);
X    &ircclient'notice($src,
X                      "CLIENTINFO CLIENTINFO ERRMSG FINGER VERSION USERINFO")
X        if ($args =~ /CLIENTINFO.+/);
X}
X
Xsub ParseChan {
X    local ($who, $cmd, $chan)= @_;
X    &ircclient'notice($owner, "ch:$who:$cmd:$chan") if ($debug & 1);
X    if ($cmd eq "JOIN") {
X        &WriteLog("jn:$who:$cmd:$chan\n") if ($log);
X	if ($WhoisUnlocked) {
X	    $WhoisUnlocked = 0;
X            &ircclient'whois($who);
X	} else {
X	    $PendingWhois = $who;
X	}
X    }
X    if ($cmd eq "PART") {
X        &WriteLog("pt:$who:$cmd:$chan\n") if ($log);
X    }
X}
X
Xsub ParseChanMsg {
X    local($src,$target,$message) = @_;
X    if ($message =~ /.+/) {
X        &ParseCTCP($src, $message);
X    }
X    &ircclient'notice($owner,"<$src:$target> $message") if ($eavesdrop);
X    &WriteLog("<$src:$target>:$message\n") if $log;
X}
X
Xsub ParseInvite {
X    local ($who, $args) = @_;
X
X    ($me,$chan) = split(/ /,$args,2);
X    if ($who eq $owner) {
X        &ircclient'join($chan);
X        $channel = $chan;
X    }
X}
X
Xsub ParseKick {
X    local($src, $args) = @_;
X    &WriteLog("kick:$src $args\n") if ($log);
X    &ircclient'kick($src, $channel) if ($args =~ /pjg/ && $kickveng);
X}
X
Xsub ParseKill { # someone killed me
X    local($src) = @_;
X    $gotme = $src;
X}
X
Xsub ParseMode {
X    local ($who, $cmd, $chan)= @_;
X    &WriteLog("mo:$who:$cmd:$chan\n") if ($log);
X}
X
Xsub ParseMsg {
X    local ($who, $msg) = @_;
X    $msg = &StripLeadingColon($msg);
X    &ParseChanMsg($who,$channel,$msg);
X}
X
Xsub ParseNotice { # just does kills for now
X    local($src,$args) = @_;
X    local($to, $msg) = split(/ /, $args, 2);
X    &ircclient'notice($owner,"no:$src \"$args\"") if ($eavesedrop);
X    &WriteLog("no:$src:$args\n") if ($log && $to !~ /\*/);
X    return unless $vengeance;
X    ($killee,$killer) =
X      ($args =~ m/Received KILL message for (.+)\.\s+Path:\s+.*\!(\S+)/);
X    if (&Upcase($killer) ne &Upcase($nick)) {
X	&ircclient'kill($killer,"killing $killee.");
X    }
X}
X
Xsub ParsePriv {
X    local($src,$args) = @_;
X    local($target,$message) = split(/ /,$args,2);
X
X    $message = &StripLeadingColon($message);
X    if (&Upcase($target) eq &Upcase($nick)) { # for me?
X	if ($message =~ /$magicword/i) {
X	    &ircclient'notice($owner, "$src said the magic word");
X	    $quitflag = 1;
X	} elsif ($message =~ /.+/) {
X	    &ParseCTCP($src, $args);
X	} elsif (&Upcase($src) eq &Upcase($owner) && $message =~ /$secret/) {
X	    &DoDuties($message);
X	} else {
X	    &RespondAppropriately($src,$message);
X	}
X    } else {
X	&ParseChanMsg($src,$target,$message);
X    }
X}
X
Xsub ParseQuit {
X    local ($who, $cmd, $chan)= @_;
X    &WriteLog("qt:$who:$cmd:$chan\n") if ($log);
X}
X
Xsub ParseWall {
X    local($who, $msg) = @_;
X    $msg = &StripLeadingColon($msg);
X    &ircclient'notice($owner,"!!$who!! $msg") if ($eavesdrop);
X    &WriteLog("wa:$who:$msg\n") if $log;
X}
X
Xsub ParseWallop {
X    local($who, $msg) = @_;
X    $msg = &StripLeadingColon($msg);
X    &ircclient'notice($owner,"!$who! $msg") if ($eavesdrop);
X    #&WriteLog("wo:$who:$msg\n") if ($log);
X    &WriteDLog("wo:$who:$msg\n") if ($log && $msg =~ /be eradicated/);
X    &WriteLog("wo:$who:$msg\n") if ($log && $msg !~ /be eradicated/);
X}
X
Xsub ParseWhoreply {
X    local($args) = @_;
X    local($l_chan, $l_user, $l_host, $l_server, $l_nick, $l_status, $l_name) =
X        split(' ', $args, 7);
X    $check = ($l_server !~ /odu/i && $l_host !~ /odu/i);
X    $check = ($check && $l_status =~ /.\*/ && $l_status !~ /..\@/);
X    if ($check && ($l_nick eq $wantop) ) {
X        &ircclient'mode($l_chan, "+o $l_nick");
X	if (!@opped{"$l_nick"}) {
X            &ircclient'notice($l_nick, "$reply") if ($nick =~ /$reply/);
X	    @opped{"$l_nick"} = 1;
X	}
X    }
X    elsif ($l_nick eq $wantop) {
X	@notopped{"$l_nick"} = 1;
X    }
X    if ($debug & 2) {
X	&ircclient'notice($owner, "$l_nick has $l_status status.")
X	    unless $l_nick eq "Nickname";
X    }
X}
X
Xsub DoDuties {
X    local($cmdline) = @_;
X    local($key, $cmd,$args) = split(/ /,$cmdline,3);
X
X    &ircclient'notice($owner, "$key $cmd $args") if ($debug & 4);
X    return if ($key ne $secret);
X
X  choose:
X    {
X	if ($cmd =~ /^msg/i)   {&ircclient'msg($args); last choose;};
X	if ($cmd =~ /^priv/i)  {&ircclient'privmsg(split(/ /,$args,2));
X			        last choose;};
X	if ($cmd =~ /^noti/i)  {&ircclient'notice(split(/ /,$args,2));
X			        last choose;};
X	if ($cmd =~ /^join/i)  {&ircclient'join($args); last choose;};
X	if ($cmd =~ /^away/i)  {&ircclient'away($args); last choose;};
X	if ($cmd =~ /^top/i)   {&ircclient'topic($args); last choose;};
X	if ($cmd =~ /^quo/i)   {&ircclient'quote($args); last choose;};
X	if ($cmd =~ /^whoi/i)  {&ircclient'whois($args); last choose;};
X        if ($cmd =~ /^inv.*/i) {&ircclient'invite($args, $channel);
X	                        last choose;};
X	if ($cmd =~ /^op/i)    {&ircclient'mode($channel, "+o $owner");
X	                        last choose;};
X	if ($cmd =~ /^say/i)   {&ircclient'privmsg($channel, $args);
X	                        last choose;};
X	if ($cmd =~ /^set/i)   {&DoSets($args); last choose;};
X	if ($cmd =~ /^stat/i)  {&DumpState($args); last choose;};
X        if ($cmd =~ /hel.*/i)  {&ircclient'notice($owner,$help); last choose;};
X    }
X}
X
Xsub DoSets {
X    local($input) = @_;
X    local($cmd, $args) = split(/ /, $input, 2);
X
X    &ircclient'notice($owner, "cmd:$cmd args:$args\n") if ($debug & 8);
X
X    $channel = $args if ($cmd =~ /cha.*/i);
X    $delay = $args if ($cmd =~ /del.*/i);
X    $owner = $args if ($cmd =~ /own.*/i);
X    $magicword = $args if ($cmd =~ /magic.*/i);
X    $reply = $args if ($cmd =~ /repl.*/i);
X    $secret = $args if ($cmd =~ /secr.*/i);
X    $debug = $args if ($cmd =~ /deb.*/i);
X    $guard = !$guard if ($cmd =~ /gua.*/i);
X    $eavesdrop = !$eavesdrop if ($cmd =~ /eav.*/i);
X    $log = !$log if ($cmd =~ /log.*/i);
X    $kickveng = !$kickveng if ($cmd =~ /kickv.*/i);
X    $vengeance = !$vengeance if ($cmd =~ /ven.*/i);
X}
X
Xsub DumpState {
X    local(@opped) = keys(%opped);
X    local(@notopped) = keys(%notopped);
X
X    &ircclient'notice($owner, "started $started owner $owner");
X    &ircclient'notice($owner, "channel $channel debug $debug delay $delay");
X    &ircclient'notice($owner, "logfile $logfile guard $guard log $log");
X    &ircclient'notice($owner, "eavesdrop $eavesdrop server $server");
X    &ircclient'notice($owner, "wantop $wantop wantinvite $wantinvite");
X    &ircclient'notice($owner, "kickveng $kickveng vengeance $vengeance");
X    &ircclient'notice($owner, "reply $reply");
X    &ircclient'notice($owner, "opped @opped");
X    &ircclient'notice($owner, "notopped @notopped");
X}
X
Xsub Quit {
X    local(@opped) = keys(%opped);
X
X    &ircclient'notice($owner,"Leaving.");
X    open(OPPED, ">>opped");
X    print (OPPED "@opped\n");
X    &ircclient'quit;
X}
X
Xsub RespondAppropriately {
X    local($src,$msg) = @_;
X
X    &ircclient'privmsg($owner,"pm:$src \"$message\".") if ($eavesdrop);
X
X    if ($msg =~ /op/) {
X        $wantop = $src;
X	&ircclient'who($channel);
X	return;
X    };
X    if ($msg =~ /inv.*/) {
X        $wantinvite = $src;
X#	$WhoisUnlocked = 0;
X	&ircclient'whois($src);
X	return;
X    };
X    if ($msg =~ /hel.*/i) {
X        &ircclient'notice($src, $help);
X	return;
X    };
X    &ircclient'notice($src, "/msg help for help");
X}
X
Xsub SetNick {
X    $nick = $original_nick . $tries;
X    $tries += 1;
X}
X
Xsub SetOper {
X    if ($operpass) {
X        &ircclient'oper('pjg',$operpass);
X        &ircclient'kill($opt_k,'Self defense.') if $opt_k;
X    }
X}
X
Xsub SetOperStat {
X    local($src, $code, $params) = @_;
X    local($to, $lnick, $rest) = split(/ /, $params);
X    &ircclient'notice($owner, "ops $lnick") if ($debug & 16);
X    if($lnick eq $wantinvite) {
X        &ircclient'invite($lnick, $channel);
X	$wantinvite .= ":";  # don't invite them again
X        &ircclient'notice($owner,"$wantinvite invite $channel")
X            if ($debug & 32);
X    }
X}
X
Xsub SetWherefrom {
X    local($args) = @_;
X    local($to, $host, $rest) = split(' ', $args);
X#    if ($host eq "ucscb.ucsc.edu") {
X#        &ircclient'mode($channel, "-o $whois") if ($debug & 64);
X#        &ircclient'privmsg($channel, "$whois is from $host.");
X#    }
X    &ircclient'notice($owner, "$whois from $host") if ($debug & 64);
X}
X
Xsub SetWhois {
X    local($args) = @_;
X    local($to, $lnick, $user, $host, $status, $name) = split(' ', $args);
X    $whois = $lnick;
X}
X
Xsub SignOn {
X    &ircclient'user($username,$username,$server,$fullname);
X    &ircclient'nick($nick);
X    if ($operpass) {
X        &ircclient'oper('pjg',$operpass);
X        &ircclient'kill($opt_k,'Self defense.') if $opt_k;
X    }
X}
X
Xsub WriteLog {
X    ($sec,$min,$hour,$date,$month,$year,$rest)=localtime();
X    $month += 1;
X    $date = "0".$date if ($date < 10);
X    $hour = "0".$hour if ($hour < 10);
X    $min = "0".$min if ($min < 10);
X    $month = "0".$month if ($month < 10);
X    print(LOG "$month/$date:$hour:$min-");
X    print(LOG "@_");
X}
X
Xsub WriteDLog {
X    ($sec,$min,$hour,$date,$month,$year,$rest)=localtime();
X    $month += 1;
X    $date = "0".$date if ($date < 10);
X    $hour = "0".$hour if ($hour < 10);
X    $min = "0".$min if ($min < 10);
X    $month = "0".$month if ($month < 10);
X    print(DLOG "$month/$date:$hour:$min-");
X    print(DLOG "@_");
X}
X
Xsub ParseVersion { last cmdcase;}
Xsub ParseLinks { last cmdcase;}
Xsub ParseLinkEnd { last cmdcase;}
//E*O*F perlserver//

echo x - ircclient.pl
sed -e 's/^X//' > "ircclient.pl" << '//E*O*F ircclient.pl//'
X#!/util/bin/perl -- # -*-Perl-*-
X
Xrequire 'sys/socket.ph';
X
Xpackage ircclient;
X
X# the basics for making CLIENT connections to an irc socket
X# *NOT* a parser, just the sending code.  Parsers are easy.
X
Xsub bindsocket {		# bind a socket
X    local($sockname,$target,$port) = @_;
X    local($sockaddr,$name,$aliases,$proto,$type,$len,
X	  $thisaddr,$thataddr,$this,$that,$savfh,$hostname);
X        
X    $sockaddr = 'S n a4 x8';
X    chop($hostname = `hostname`);
X    $sockname =~ s/^([^']+)$/(caller)[$[]."'".$1/e;
X    
X    ($name, $aliases, $proto) = getprotobyname('tcp');
X    ($name, $aliases, $port) = getservbyname($port, 'tcp')
X	unless $port =~ /^\d+$/;;
X    ($name, $aliases, $type, $len, $thisaddr) = gethostbyname($hostname);
X    ($name, $aliases, $type, $len, $thataddr) = gethostbyname($target);
X    
X    $this = pack($sockaddr, &main'AF_INET, 0, $thisaddr);
X    $that = pack($sockaddr, &main'AF_INET, $port, $thataddr);
X    
X    socket($sockname, &main'PF_INET, &main'SOCK_STREAM, $proto) ||
X	die "socket $sockname: $!";
X    bind($sockname, $this) || die "bind $sockname: $!";
X    connect($sockname, $that) || die "connect $sockname: $!";
X    $savfh = select($sockname); $| = 1; select($savfh);
X    $socket = $sockname;
X}
X
Xsub admin {
X    local($target) = @_;
X
X    send($socket,"ADMIN $target\n",0);
X}
X
Xsub away {
X    local($message) = @_;
X    $message = " :$message" if $message;
X    send($socket,"AWAY$message\n",0);
X}
X
Xsub channel {
X    local($channel) = @_;
X
X    send($socket,"CHANNEL $channel\n",0);
X}
X
Xsub connect {
X    local($toserver, $port, $fromserver) = @_;
X
X    send($socket, "CONNECT $toserver $port $fromserver\n",0);
X}
X
X
Xsub deoper {
X    send($socket, "DEOPER\n",0);
X}
X
Xsub die {
X    send($socket, "DIE\n",0);
X}
X
Xsub info {
X    local($target) = @_;
X
X    send($socket,"INFO $target\n",0);
X}
X
Xsub invite {
X    local($target,$channel) = @_;
X    send($socket, "INVITE $target $channel\n",0);
X}
X
Xsub join {
X    local($channel) = @_;
X    send($socket, "JOIN $channel\n",0);
X}
X
Xsub kick {
X    local($channel,$target) = @_;
X    send($socket, "KICK $channel $target\n",0);
X}
X
Xsub kill {
X    local($target,$comment) = @_;
X    send($socket, "KILL $target $comment\n",0);
X}
X
Xsub links {
X    local($mask) = @_;
X    send($socket, "LINKS $mask\n",0);
X}
X
Xsub list {
X    local($channel) = @_;
X    send($socket, "LIST $channel\n",0);
X}
X
Xsub lusers {
X    send($socket, "LUSERS\n",0);
X}
X
Xsub mode {
X    local($channel,$mode) = @_;
X    send($socket, "MODE $channel $mode\n",0);
X}
X
Xsub motd {
X    local($target) = @_;
X
X    send($socket, "MOTD $target\n",0);
X}
X
Xsub msg {
X    local(@strings)=@_;
X    foreach(@strings){
X	send($socket,"MSG :$_\n",0);
X    }
X}
X
Xsub names {
X    local($channel) = @_;
X    send($socket, "NAMES $channel\n",0);
X}
X
Xsub nick {
X    local($target)=@_;
X    send($socket, "${srcstring}NICK $target\n",0);
X}
X
Xsub notice {
X    local($target,@strings)=@_;
X    foreach(@strings){
X	send($socket,"NOTICE $target :$_\n",0);
X    }
X}
X
Xsub oper {
X    local($name,$passwd) = @_;
X
X    send($socket,"OPER $name $passwd\n",0);
X}
X
Xsub part {
X    local($channel)=@_;
X    send($socket, "PART $channel\n",0);
X}
X
Xsub pong {
X    local($target)=@_;
X    send($socket, "PONG $target\n",0);
X}
X
Xsub privmsg {
X    local($target,@strings)=@_;
X    foreach(@strings){
X	send($socket,"PRIVMSG $target :$_\n",0);
X    }
X}
X
Xsub quit {
X    send($socket, "QUIT\n",0);
X}
X
Xsub quote {
X    send($socket,"@_\n", 0);
X}
X
Xsub squit {
X    local($target)=@_;
X    send($socket, "SQUIT $target\n",0);
X}
X
Xsub stats {
X    local($target,$flags)=@_;
X    send($socket, "STATS $flags $target\n",0);
X}
X
Xsub summon {
X    local($target) = @_;
X
X    send($socket, "SUMMON $target\n",0);
X}
X
Xsub time {
X    local($target) = @_;
X
X    send($socket, "TIME $target\n",0);
X}
X
Xsub topic {
X    local($string)=@_;
X    send($socket, "TOPIC $string\n",0);
X}
X
Xsub trace {
X    local($target)=@_;
X    send($socket, "TRACE $target\n",0);
X}
X
Xsub user {
X    local($username,$machine,$server,$fullname)=@_;
X    send($socket, "USER $username $machine $server $fullname\n",0);
X}
X
Xsub users {
X    local($target)=@_;
X    send($socket, "USERS $target\n",0);
X}
Xsub version {
X    local($target)=@_;
X    send($socket, "VERSION $target\n",0);
X}
X
Xsub voice {
X    local($target,$string)=@_;
X    send($socket,"VOICE $target :$string\n",0);
X}
X
Xsub wall {
X    local($string)=@_;
X    send($socket,"WALL $string\n",0);
X}
X
Xsub wallops {
X    local($string)=@_;
X    send($socket,"WALLOPS $string\n",0);
X}
X
Xsub who {
X    local($mask) = @_;
X    send($socket,"WHO $mask\n",0);
X}
X
Xsub whois {
X    local($mask) = @_;
X    send($socket,"WHOIS $mask\n",0);
X}
X
Xsub whowas {
X    local($mask) = @_;
X    send($socket,"WHOWAS $mask\n",0);
X}
X
X1;				# so require works right.
//E*O*F ircclient.pl//

exit 0
