mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhdb.pl,2.27,2.28 mhdysub.pl,2.8,2.9 mhinit.pl,2.4...

2002-12-31 13:01:51
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv16644/lib

Modified Files:
	mhdb.pl mhdysub.pl mhinit.pl mhopt.pl mhrcfile.pl readmail.pl 
Log Message:
* Added MODIFYBODYADDRESSES resource.


Index: mhdb.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhdb.pl,v
retrieving revision 2.27
retrieving revision 2.28
diff -C2 -r2.27 -r2.28
*** mhdb.pl	31 Dec 2002 05:03:30 -0000	2.27
--- mhdb.pl	31 Dec 2002 20:01:37 -0000	2.28
***************
*** 148,151 ****
--- 148,152 ----
  print_var($db,'AddressModify',  \$AddressModify)
  				unless $IsDefault{'AddressModify'};
+ print_var($db,'AddrModifyBodies', \$AddrModifyBodies);
  print_var($db,'CheckNoArchive', \$CheckNoArchive);
  print_var($db,'DOCURL',         \$DOCURL);

Index: mhdysub.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhdysub.pl,v
retrieving revision 2.8
retrieving revision 2.9
diff -C2 -r2.8 -r2.9
*** mhdysub.pl	19 Dec 2002 05:08:31 -0000	2.8
--- mhdysub.pl	31 Dec 2002 20:01:37 -0000	2.9
***************
*** 36,39 ****
--- 36,42 ----
  ##	are candidates.
  ##
+ ##	NOTE: Subroutine references would be cleaner, but code
+ ##	      pre-dates Perl 5 where references were not supported.
+ ##
  sub create_routines {
      my($sub) = '';
***************
*** 146,149 ****
--- 149,170 ----
      eval $sub;
      die("ERROR: Unable to create rewrite_address routine:\n$(_at_)\n") if $@;
+ 
+     ##-----------------------------------------------------------------------
+     ##	Routine to rewrite mail addresses in message bodies
+     ##
+     if ($AddrModifyBodies) {
+ 	$sub =<<EndOfRoutine;
+ sub rewrite_body_address {
+     package mhonarc::Pkg_rewrite_body_address;
+     local \$_ = shift;
+     $AddressModify;
+     \$_;
+ }
+ EndOfRoutine
+ 	$sub .= "# $_sub_eval_cnt\n";  ++$_sub_eval_cnt;
+ 	eval $sub;
+ 	die("ERROR: Unable to create rewrite_body_address routine:\n$(_at_)\n")
+ 	    if $@;
+     }
  
      ##-----------------------------------------------------------------------

Index: mhinit.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhinit.pl,v
retrieving revision 2.41
retrieving revision 2.42
diff -C2 -r2.41 -r2.42
*** mhinit.pl	31 Dec 2002 05:03:30 -0000	2.41
--- mhinit.pl	31 Dec 2002 20:01:37 -0000	2.42
***************
*** 374,377 ****
--- 374,379 ----
  $POSIXstrftime = defined($ENV{'M2H_POSIXSTRFTIME'}) ?
  			 $ENV{'M2H_POSIXSTRFTIME'} : 0;
+ $AddrModifyBodies  = defined($ENV{'M2H_MODIFYBODYADDRESSES'}) ?
+ 			     $ENV{'M2H_MODIFYBODYADDRESSES'} : 0;
  
  if ($UNIX) {

Index: mhopt.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhopt.pl,v
retrieving revision 2.46
retrieving revision 2.47
diff -C2 -r2.46 -r2.47
*** mhopt.pl	26 Dec 2002 21:57:04 -0000	2.46
--- mhopt.pl	31 Dec 2002 20:01:37 -0000	2.47
***************
*** 42,202 ****
      die(qq{Try "$PROG -help" for usage information\n}) unless
      GetOptions(\%opt,
! 	"add",		# Add a message to archive
! 	"afs",		# Bypass file permission checks
! 	"addressmodifycode=s",
  			# Perl expression for modifying displayed addresses
! 	"annotate",	# Add a note to message(s)
! 	"authsort",	# Sort by author
! 	"archive",	# Create an archive (the default)
! 	"conlen",	# Honor Content-Length fields
! 	"checknoarchive",
! 			# Check for "no archive" flag in messages
! 	"datefields=s", # Fields that contains the date of a message
! 	"dbfile=s",	# Database/state filename for mhonarc archive
! 	"dbfileperms=i",# Octal permission to set DBFILE
! 	"decodeheads",	# Decode all 1522 encoded data in message headers
! 	"definevar|definevars=s@",
  			# Define custom resource variables
! 	"doc",		# Print link to doc at end of index page
! 	"docurl=s",	# URL to mhonarc documentation
! 	"editidx",	# Change index page layout only
! 	"expiredate=s",	# Message cut-off date
! 	"expireage=i",	# Time in seconds from current if message expires
! 	"fileperms=i",	# Octal permission to create files
! 	"folrefs",	# Print links to explicit follow-ups/references
! 	"footer=s",	# File containing user text for bottom of index page
  			# 	(option no longer applicable)
! 	"force",	# Perform archive operation even if unable to lock
! 	"fromfields=s", # Fields that contains the "from" of a message
! 	"genidx",	# Generate an index based upon archive contents
! 	"gmtdatefmt=s",	# Date specification for GMT date
! 	"gzipexe=s",	# Pathname of Gzip executable
! 	"gzipfiles",	# Gzip files
! 	"gziplinks",	# Add ".gz" extensions to files
! 	"header=s",	# File containing user text for top of index page
  			# 	(option no longer applicable)
! 	"htmlext=s",	# Extension for HTML files
! 	"idxfname=s",	# Filename of index page
! 	"idxprefix=s",	# Filename prefix for multi-page main index
! 	"idxsize=i",	# Maximum number of messages shown in indexes
! 	"keeponrmm",	# Do not delete message files on archive remove
! 	"localdatefmt=s",
  			# Date specification for local date
! 	"lock",		# Do archive locking (default)
! 	"lockdelay=i",	# Time delay in seconds between lock tries
! 	"lockmethod=s",	# Set the method of locking
! 	"locktries=i",	# Number of tries in locking an archive
! 	"mailtourl=s",	# URL to use for e-mail address hyperlinks
! 	"main",		# Create a main index
! 	"maxsize=i",	# Maximum number of messages allowed in archive
! 	"mbox",		# Use mailbox format		(ignored now)
! 	"mh",		# Use MH mail folders format	(ignored now)
! 	"mhpattern=s",	# Regular expression for message files in a directory
! 	"modtime",	# Set modification time on files to message date
! 	"months=s",	# Month names
! 	"monthsabr=s",	# Abbreviated month names
! 	"msgexcfilter=s",
  			# Perl expression(s) for selective message exclusion
! 	"msgpgs",	# Create message pages
! 	"msgsep=s",	# Message separator for mailbox files
! 	"msgprefix=s",	# Filename prefix for message files
! 	"multipg",	# Generate multi-page indexes
! 	"news",		# Add links to newsgroups
! 	"noauthsort",	# Do not sort by author
! 	"noarchive",	# Do not create an archive
! 	"nochecknoarchive",
! 			# Do not check for "no archive" flag in messages
! 	"noconlen",	# Ignore Content-Length fields
! 	"nodecodeheads",
  			# Do not decode 1522 encoded data in message headers
! 	"nodoc",	# Do not print link to doc at end of index page
! 	"nofolrefs",	# Do not print links to explicit follow-ups/references
! 	"nogzipfiles",	# Do not Gzip files
! 	"nogziplinks",	# Do not add ".gz" extensions to files
! 	"nokeeponrmm",	# Delete message files on archive remove
! 	"nolock",	# Do no archive locking
! 	"nomailto",	# Do not add in mailto links for e-mail addresses
! 	"nomain",	# Do not create a main index
! 	"nomsgpgs",	# Do not create message pages
! 	"nomodtime",	# Do no set modification time on files to message date
! 	"nomultipg",	# Do not generate multi-page indexes
! 	"nonews",	# Do not add links to newsgroups
! 	"noposixstrftime",
  			# Use own implementation for time format process
! 	"noreverse",	# List messages in normal order
! 	"nosaveresources",
  			# Do not save resource values in db
! 	"nosort",	# Do not sort
! 	"nospammode",	# Do not run in (anti)spam mode
! 	"nosubsort",	# Do not sort by subject
! 	"nosubjectthreads",
  			# Do not do subject based threading
! 	"nosubjecttxt=s",
  			# Text to use if message has no subject
! 	"notedir",	# Location of notes
! 	"notetext=s@",	# Text data of note
! 	"nothread",	# Do not create threaded index
! 	"notreverse",	# List oldest thread first
! 	"notsubsort|tnosubsort",
  			# Do not list threads by subject
! 	"notsort|tnosort",
  			# List threads by ordered processed
! 	"nourl",	# Do not make URL hyperlinks
! 	"otherindex|otherindexes=s@",
  			# List of other rcfiles for extra indexes
! 	"outdir=s",	# Destination of HTML files
! 	"pagenum=s",	# Page to output if -genidx
! 	"perlinc=s@",	# List of paths to search for MIME filters
! 	"posixstrftime",
  			# Use POSIX strftime()
! 	"quiet",	# No status messages while running
! 	"rcfile=s@",	# Resource file for mhonarc
! 	"varregex=s",	# Regex matching resource variables
! 	"reverse",	# List messages in reverse order
! 	"rmm",		# Remove messages from an archive
! 	"savemem",	# Write message data while processing
! 	"saveresources",
  			# Save resource values in db
! 	"scan",		# List out archive contents to terminal
! 	"single",	# Convert a single message to HTML
! 	"sort",		# Sort messages in increasing date order
! 	"spammode",	# Run in (anti)spam mode
! 	"stderr=s",	# Set file for stderr
! 	"stdin=s",	# Set file for stdin
! 	"stdout=s",	# Set file for stdout
! 	"subjectarticlerxp=s",
  			# Regex for leading articles in subjects
! 	"subjectreplyrxp=s",
  			# Regex for leading reply string in subjects
! 	"subjectstripcode=s",
  			# Perl expression for modifying subjects
! 	"subjectthreads",
  			# Check subjects for threads
! 	"subsort",	# Sort message by subject
! 	"tidxfname=s",	# File name of threaded index page
! 	"tidxprefix=s",	# Filename prefix for multi-page thread index
! 	"time",		# Print processing time
! 	"title=s",	# Title of index page
! 	"ttitle=s",	# Title of threaded index page
! 	"thread",	# Create threaded index
! 	"tlevels=i",	# Maximum # of nested lists in threaded index
! 	"treverse",	# Reverse order of thread listing
! 	"tslice=s",	# Set size of thread slice listing
! 	"tslicelevels=i",
  			# Maximum # of nested lists in thread slices
! 	"tsort",	# List threads by date
! 	"tsubsort",	# List threads by subject
! 	"umask=i",	# Set umask of process
! 	"url",		# Make URL hyperlinks
! 	"weekdays=s",	# Weekday names
! 	"weekdaysabr=s",
  			# Abbreviated weekday names
  
  	## API (only?) options
! 	"noarg", 	# Just load code
! 	"readdb",	# Just read db
  
! 	"v",		# Version information
! 	"help"		# A brief usage message
      );
  
--- 42,204 ----
      die(qq{Try "$PROG -help" for usage information\n}) unless
      GetOptions(\%opt,
! 	'add',		# Add a message to archive
! 	'afs',		# Bypass file permission checks
! 	'addressmodifycode=s',
  			# Perl expression for modifying displayed addresses
! 	'annotate',	# Add a note to message(s)
! 	'authsort',	# Sort by author
! 	'archive',	# Create an archive (the default)
! 	'conlen',	# Honor Content-Length fields
! 	'checknoarchive',
! 			# Check for 'no archive' flag in messages
! 	'datefields=s', # Fields that contains the date of a message
! 	'dbfile=s',	# Database/state filename for mhonarc archive
! 	'dbfileperms=i',# Octal permission to set DBFILE
! 	'decodeheads',	# Decode all 1522 encoded data in message headers
! 	'definevar|definevars=s@',
  			# Define custom resource variables
! 	'doc',		# Print link to doc at end of index page
! 	'docurl=s',	# URL to mhonarc documentation
! 	'editidx',	# Change index page layout only
! 	'expiredate=s',	# Message cut-off date
! 	'expireage=i',	# Time in seconds from current if message expires
! 	'fileperms=i',	# Octal permission to create files
! 	'folrefs',	# Print links to explicit follow-ups/references
! 	'footer=s',	# File containing user text for bottom of index page
  			# 	(option no longer applicable)
! 	'force',	# Perform archive operation even if unable to lock
! 	'fromfields=s', # Fields that contains the 'from' of a message
! 	'genidx',	# Generate an index based upon archive contents
! 	'gmtdatefmt=s',	# Date specification for GMT date
! 	'gzipexe=s',	# Pathname of Gzip executable
! 	'gzipfiles',	# Gzip files
! 	'gziplinks',	# Add ".gz" extensions to files
! 	'header=s',	# File containing user text for top of index page
  			# 	(option no longer applicable)
! 	'htmlext=s',	# Extension for HTML files
! 	'idxfname=s',	# Filename of index page
! 	'idxprefix=s',	# Filename prefix for multi-page main index
! 	'idxsize=i',	# Maximum number of messages shown in indexes
! 	'keeponrmm',	# Do not delete message files on archive remove
! 	'localdatefmt=s',
  			# Date specification for local date
! 	'lock',		# Do archive locking (default)
! 	'lockdelay=i',	# Time delay in seconds between lock tries
! 	'lockmethod=s',	# Set the method of locking
! 	'locktries=i',	# Number of tries in locking an archive
! 	'mailtourl=s',	# URL to use for e-mail address hyperlinks
! 	'main',		# Create a main index
! 	'maxsize=i',	# Maximum number of messages allowed in archive
! 	'mbox',		# Use mailbox format		(ignored now)
! 	'mh',		# Use MH mail folders format	(ignored now)
! 	'mhpattern=s',	# Regular expression for message files in a directory
! 	'modifybodyaddresses',
! 			# addressmodifycode applies to text entities
! 	'modtime',	# Set modification time on files to message date
! 	'months=s',	# Month names
! 	'monthsabr=s',	# Abbreviated month names
! 	'msgexcfilter=s',
  			# Perl expression(s) for selective message exclusion
! 	'msgpgs',	# Create message pages
! 	'msgsep=s',	# Message separator for mailbox files
! 	'msgprefix=s',	# Filename prefix for message files
! 	'multipg',	# Generate multi-page indexes
! 	'news',		# Add links to newsgroups
! 	'noauthsort',	# Do not sort by author
! 	'noarchive',	# Do not create an archive
! 	'nochecknoarchive',
! 			# Do not check for 'no archive' flag in messages
! 	'noconlen',	# Ignore Content-Length fields
! 	'nodecodeheads',
  			# Do not decode 1522 encoded data in message headers
! 	'nodoc',	# Do not print link to doc at end of index page
! 	'nofolrefs',	# Do not print links to explicit follow-ups/references
! 	'nogzipfiles',	# Do not Gzip files
! 	'nogziplinks',	# Do not add '.gz' extensions to files
! 	'nokeeponrmm',	# Delete message files on archive remove
! 	'nolock',	# Do no archive locking
! 	'nomailto',	# Do not add in mailto links for e-mail addresses
! 	'nomain',	# Do not create a main index
! 	'nomsgpgs',	# Do not create message pages
! 	'nomodtime',	# Do no set modification time on files to message date
! 	'nomultipg',	# Do not generate multi-page indexes
! 	'nonews',	# Do not add links to newsgroups
! 	'noposixstrftime',
  			# Use own implementation for time format process
! 	'noreverse',	# List messages in normal order
! 	'nosaveresources',
  			# Do not save resource values in db
! 	'nosort',	# Do not sort
! 	'nospammode',	# Do not run in (anti)spam mode
! 	'nosubsort',	# Do not sort by subject
! 	'nosubjectthreads',
  			# Do not do subject based threading
! 	'nosubjecttxt=s',
  			# Text to use if message has no subject
! 	'notedir',	# Location of notes
! 	'notetext=s@',	# Text data of note
! 	'nothread',	# Do not create threaded index
! 	'notreverse',	# List oldest thread first
! 	'notsubsort|tnosubsort',
  			# Do not list threads by subject
! 	'notsort|tnosort',
  			# List threads by ordered processed
! 	'nourl',	# Do not make URL hyperlinks
! 	'otherindex|otherindexes=s@',
  			# List of other rcfiles for extra indexes
! 	'outdir=s',	# Destination of HTML files
! 	'pagenum=s',	# Page to output if -genidx
! 	'perlinc=s@',	# List of paths to search for MIME filters
! 	'posixstrftime',
  			# Use POSIX strftime()
! 	'quiet',	# No status messages while running
! 	'rcfile=s@',	# Resource file for mhonarc
! 	'varregex=s',	# Regex matching resource variables
! 	'reverse',	# List messages in reverse order
! 	'rmm',		# Remove messages from an archive
! 	'savemem',	# Write message data while processing
! 	'saveresources',
  			# Save resource values in db
! 	'scan',		# List out archive contents to terminal
! 	'single',	# Convert a single message to HTML
! 	'sort',		# Sort messages in increasing date order
! 	'spammode',	# Run in (anti)spam mode
! 	'stderr=s',	# Set file for stderr
! 	'stdin=s',	# Set file for stdin
! 	'stdout=s',	# Set file for stdout
! 	'subjectarticlerxp=s',
  			# Regex for leading articles in subjects
! 	'subjectreplyrxp=s',
  			# Regex for leading reply string in subjects
! 	'subjectstripcode=s',
  			# Perl expression for modifying subjects
! 	'subjectthreads',
  			# Check subjects for threads
! 	'subsort',	# Sort message by subject
! 	'tidxfname=s',	# File name of threaded index page
! 	'tidxprefix=s',	# Filename prefix for multi-page thread index
! 	'time',		# Print processing time
! 	'title=s',	# Title of index page
! 	'ttitle=s',	# Title of threaded index page
! 	'thread',	# Create threaded index
! 	'tlevels=i',	# Maximum # of nested lists in threaded index
! 	'treverse',	# Reverse order of thread listing
! 	'tslice=s',	# Set size of thread slice listing
! 	'tslicelevels=i',
  			# Maximum # of nested lists in thread slices
! 	'tsort',	# List threads by date
! 	'tsubsort',	# List threads by subject
! 	'umask=i',	# Set umask of process
! 	'url',		# Make URL hyperlinks
! 	'weekdays=s',	# Weekday names
! 	'weekdaysabr=s',
  			# Abbreviated weekday names
  
  	## API (only?) options
! 	'noarg', 	# Just load code
! 	'readdb',	# Just read db
  
! 	'v',		# Version information
! 	'help'		# A brief usage message
      );
  
***************
*** 575,578 ****
--- 577,583 ----
      $POSIXstrftime  = 0  if $opt{'noposixstrftime'};
  
+     $AddrModifyBodies = 1  if $opt{'modifybodyaddresses'};
+     $AddrModifyBodies = 0  if $opt{'nomodifybodyaddresses'};
+ 
      $DecodeHeads = 1 if $opt{'decodeheads'};
      $DecodeHeads = 0 if $opt{'nodecodeheads'};
***************
*** 669,672 ****
--- 674,686 ----
      } else {
  	$IsDefault{'TEXTCLIPFUNC'} = 0;
+     }
+ 
+     ## Check if rewriting addresses in bodies
+     if ($AddrModifyBodies) {
+ 	$readmail::TextPreFilter = sub {
+ 	    my $fields = shift;
+ 	    my $data_r = shift;
+ 	    $$data_r =~ s/($AddrExp)/rewrite_body_address($1)/geo;
+ 	}
      }
  

Index: mhrcfile.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhrcfile.pl,v
retrieving revision 2.31
retrieving revision 2.32
diff -C2 -r2.31 -r2.32
*** mhrcfile.pl	31 Dec 2002 05:03:30 -0000	2.31
--- mhrcfile.pl	31 Dec 2002 20:01:37 -0000	2.32
***************
*** 517,520 ****
--- 517,523 ----
  	    last FMTSW;
  	}
+ 	if ($elem eq 'modifybodyaddresses') {	# Modify addresses in bodies
+ 	    $AddrModifyBodies = 1; last FMTSW;
+ 	}
  	if ($elem eq 'months') {		# Full month names
  	    @a = &get_list_content($handle, $elem);
***************
*** 620,623 ****
--- 623,629 ----
  	if ($elem eq 'nofolrefs') {		# Don't print explicit fol/refs
  	    $DoFolRefs = 0; last FMTSW;
+ 	}
+ 	if ($elem eq 'nomodifybodyaddresses') {	# Don't modify addresses
+ 	    $AddrModifyBodies = 0; last FMTSW;
  	}
  	if ($elem eq 'nogzipfiles') {		# Don't gzip files

Index: readmail.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/readmail.pl,v
retrieving revision 2.26
retrieving revision 2.27
diff -C2 -r2.26 -r2.27
*** readmail.pl	20 Dec 2002 08:01:11 -0000	2.26
--- readmail.pl	31 Dec 2002 20:01:37 -0000	2.27
***************
*** 227,230 ****
--- 227,234 ----
      unless defined($TextEncodingSrc);
  
+ ##  Prefilter function
+ $TextPreFilter  = undef
+     unless defined($TextPreFilter);
+ 
  ##---------------------------------------------------------------------------
  ##	Variables holding functions for generating processed output
***************
*** 534,537 ****
--- 538,544 ----
  	    $fields->{'x-mha-charset'} = $TextEncode
  		if defined(&$textfunc($body, $charset, $TextEncode));
+ 	}
+ 	if (defined($TextPreFilter) && defined(&$TextPreFilter)) {
+ 	    &$TextPreFilter($fields, $body);
  	}
      }

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV