############################
# .randomsigrc CONFIG FILE #

#  You can pretty much use any Perl expression you want
# in this file since it is called as a Perl code block.
# All statments must end with a semicolon(;) to make it
# valid.  And don't put any dashes in your variable names.
#
#  Some of the variables in this file are here just for
# convience and modularity.  You can create your own 
# variables for the same purpose.  Any variable in this
# config file that is in upper case needs to be there.
# But you can still set it to what you want.
# Make sense?  Good.

#*********************************************************
# I like to have the current month and year available
# to me so that I can use them to help determine filenames
# of some of my mailfiles.
$epoch_seconds = time();
@months = ('January','Febuary','March','April','May','June','July',
			'August','September','October','November','December');
$current_month = $months[(localtime($epoch_seconds))[4]];
$current_year  = (localtime($epoch_seconds))[5] + 1900;

#***********************************************************
# I like to setup variables for each of the mailboxes that
# I use in my @FILES array.  This makes the @FILES array
# easier/faster to read and manipulate.

$username	= (getpwuid($<))[0];
$homedir	= (getpwuid($<))[7];
$maildir	= "$homedir/mail";

if (-e "$homedir/Maildir" && -d "$homedir/Maildir") {
	$inbox  = "$homedir/Maildir/";
} elsif (-e "$homedir/Mailbox") {
	$inbox	= "$homedir/Mailbox";
} else {
	$inbox	= "/var/spool/mail/$username";
}
$sentmail	= "$maildir/sent-mail";     # Normal mail box.
$mailbox1	= "$maildir/saved-messages.gz";   # Gzipped mail box.
$mailbox2	= "$maildir/saved-messages-$current_year-$current_month/";  # This is a Maildir format mailbox.
									    # Put a / at the end.

#****************************************************************
# Set $SIGFILE to whatever you use for a signature file.  This
# file will either become a named pipe or a regular file
# depending on whether you use the -s option or not.

$SIGFILE	= "$homedir/.signature";

#******************************************************************
# The $SIGREAD file is where your signature form is kept.  You can
# put the string $theline somewhere in the file wherever you want
# your random sign line to be.

$SIGREAD	= "$homedir/.sigread";

#*****************************************************************
# The @FILES array is a list of filenames or variable names
# separated by comma that will be read and searched for lines
# that qualify as worthy to be used as a random signature.
#

@FILES		= ($inbox, $sentmail, $mailbox1, $mailbox2);

#*****************************************************************
# The @QUOTES array is a list of filenames or variable names
# separated by comma that will be read in and *all* the lines
# will qualify as worthy to be used as a random signature.
# This is useful if you want to include some of your own quotes
# or sayings as possibilities for a random sig.
#

@QUOTES		= ("$homedir/.sigquotes");

#*******************************************************************
# A cancel file can be used to make it convient for you to
# exclude lines from qualifying as potential random signatures.
# Each line of the file can include just a normal line in full
# that must exactly match the line that you want to exlude.  Or
# You can use a perl regular expression on a line to match a line.
#

$CANCELFILE	= "$homedir/.sigcancel";

#*****************************************************************
# The REREAD_TIME variable is a measure of how long the program
# will wait until it re-reads the files that it pulls the random
# strings from.  Note that the files won't be read again until
# the first time you read from the signature after this amount
# of time has passed. Try not to set it to anything less than the
# time it takes for it to parse all the files initially.  Keeping
# the number above a minute or so should be a good bet but I'd
# recommend setting it to at least "5 minutes" to be safe and
# conserve CPU if you are reading through a lot of files or big
# ones.  The program won't read from any files that haven't
# changed since last time they were read in.
#
#  Setting this value to 0 (zero) will make randomsig wait until
# all the current signature lines in the signature array have been
# used before going out and updating the signature array of the
# program.  Even if you set the $REREAD_TIME to a high value, the
# program will exhaust all signatures in the signature array before
# using the same one twice.
#
#  I've written a small string parser that will take worded time
# arguements instead of just the number of seconds.  So if you 
# want to re-read the files every day you can set the value to
# "1 day".  If you want it to be some odd amount of time you can
# say things like  "2 days, 5 hours and 1 minute"
#  The parser doesn't care if you put commas or certain words
# between each set of time.  Some example values are:
#
#   "300 seconds"
#   "5 minutes"
#   "1 day 1 hour 1 minute 1 second"
#   "1 d 1 h 1 m 1 s"
#   60   # one minute in seconds.
#   86400  # one day in seconds.
#   0      # Wait for all the current signatures to exhaust before updating.
#
# The time strings can be used for the $REREAD_TIME and
# $UPDATE_TIME values.

$REREAD_TIME = "2 hours";
#$REREAD_TIME = 0;

#*******************************************************************
# The UPDATE_TIME variable only works when the program is run
# in safe mode(-s option).  This variable tells randomsig how often
# it should update the signature file with a new signature when it
# is not in named pipe mode.

$UPDATE_TIME = "1 minute";

#*********************************************************
# CHECK_TIME specifies how long randomsig should wait
# between checking the last accesstime of the signature
# file when running in normal mode.  This time can be
# specified in fractions of a second.  Don't set this too
# low or you'll use lots of CPU.

$CHECK_TIME = 2.5;

#*****************************************
# Wrap the lines at this many characters.
# This is an autowrap feature to catch
# lines that will overflow, you can also
# use '\n' sequences in your quotes files
# to break a line.

$WRAP_AT = 72;

#*******************************************************
# MAIN_EXPRESSION is the regular expression used to
# match lines from the files in the @files array.
# Unless you know what you are doing with Perl 
# regular expressions I'd recommend leaving this alone.
# But I'd highly recommend reading the perlre man page.

$MAIN_EXPRESSION = '^[ ]*[A-Z].*[\.\!\?]$';

#*******************************************************
# The following two variables allow you to mutate the
# line in some way before it is output to the signature
# file or spit out through the named pipe.  Right now
# you can only do one mutation and it does it on all
# lines including lines from the quotes files.
# The example values here take the leading spaces out
# of the output line.  Again, check out the perlre man
# page.  Also keep in mind that the regular expression
# uses the g flag to make substitutions to the random
# line global instead of only matching once.

$MUTATION_FROM = '^\s+';  # Removes begining whitespace from line.
$MUTATION_TO = '';

#******************************************************
# Mail quoting is an experimental feature to see if
# random sig lines can provide some representation of
# who wrote the line that was choosen.  This is done
# by caching the last seem From: line and using the
# e-mail address on that line.  To turn mail quoting
# on, just uncomment this line:

#$MAIL_QUOTING = 1;

#*******************************************************
# If MAIL_QUOTING is enabled you can set the following
# variable if you wish to remove the @domain extension
# of the e-mail address that will be put in the quote
# part of the signature.  This makes it nice for shortening
# signatures when people who see the signature will
# know whose username it is.

#$MAIL_QUOTE_LOCALDOMAIN = 'suso.org';
#$MAIL_QUOTE_LOCALDOMAIN = '(suso.org|kiva.net|yourdomain.com)';

#                      #
# END OF CONFIGURATION #
########################
