#!/usr/bin/perl # # Moderators: DO NOT CHANGE LIST OF REASONS!!! # $reason = shift( @ARGV ); $nReasons = 0; sub addReason { local( $long ) = pop( @_ ); local( $short ) = pop( @_ ); $reasons{$short} = $long; @answers[$nReasons++] = $short; } # # Robomod Maintainers: Modify this section until _END_ # $rejectedAddress = "scrm-rejected\@algebra.com"; &addReason( "abuse", "This person has been blacklisted as an abuser" ); &addReason( "crosspost", "Inappropriate crossposting" ); &addReason( "charter", "Technical violation of charter " . "(binary, exc. quoting)" ); &addReason( "harassing", "Message of harassing/insulting/hatemongering content" ); &addReason( "offtopic", "Message is grossly off topic (spam, turks, etc)" ); # # _END_ # Do NOT modify the rest ####################################################################### sub isInPath { local( $exec ) = pop( @_ ); local( @Path ) = split( /:/, $ENV{'PATH'} ); local( $i ); foreach $i (@Path) { return 1 if( -x "$i/$exec" ); } return 0; } sub checkPath { local( @execs ) = ( 'whoami', 'pgp', 'sendmail' ); local( $i ); foreach $i (@execs) { if( !&isInPath( $i ) ) { die "ATTENTION: Program '$i' is REQUIRED to reject articles, but is\n" . "not in your PATH. Check settings of your PATH environment " . "variable. \n"; } } } checkPath; sub sendMessage { $reason = pop( @_ ); open( SENDING, "| (pgp -eaf +batchmode $rejectedAddress 2>/dev/null " . " | mail $rejectedAddress)" ); $whoami = `whoami`; chop $whoami; print SENDING "processRejected $whoami $reason $Explanation\n"; while( <> ) { print SENDING; } close( SENDING ); } open( TTYIN, "/dev/tty" ); open( TTYOUT, "> /dev/tty" ); while( ! $reasons{$reason} ) { print TTYOUT "\n\n\n\n\n\nPlease choose your reason for rejection:\n\n"; for( $i = 0; $i <= $#answers; $i++ ) { print TTYOUT " $i: $answers[$i] ($reasons{$answers[$i]})\n"; } print TTYOUT "\n\nYour choice [0-$#answers]==>"; $answer = ; chop $answer; if( $answer =~ /[0-9]*/ && $answer <= $#answers ) { $reason = $answers[$answer]; } else { $reason = ""; } } print TTYOUT "\n\nType a ONE-LINE explanation of your rejection. \nIf you do " . "not feel like typing, simply press ENTER.\n\n==>"; $Explanation = ; chop $Explanation; &sendMessage( $reason );