Great Circle Associates Majordomo-Users
(April 1997)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Patch to make digest_rm_f(ron|oo)ter work
From: Nick Perry <nick @ aboard . co . uk>
Date: Fri, 11 Apr 1997 17:30:58 +0100
To: majordomo-workers @ greatcircle . com, majordomo-users @ greatcircle . com

I mentioned this way back in November, but appeared to never have posted
the result - prompted by a list subscriber, I've digged it out again....

Here is a patch for digest that implements the features hinted at in
the digest_rm_fronter and digest_rm_footer config items. Basically
it removes message_fronter and message_footer items from each 
message that comprises the digest.

The code is deeply ugly, but then so it the rest of digest! It was
written for 1.94, but I've just made it work for 1.94.1 too.

It removes the fronters/footers when it makes the digest, not
as it goes along, so if you change your fronters/footers at
any time, only the most recent messages that comprise the digest will
be stripped correctly.

Purists may want to patch config_parse.pl too - to remove the "this function
is not operative" text from the desriptions of digest_rm_fronter and 
digest_rm_footer.

NB: This is crud-ware, if it works for you it's a bonus, if it doesn't
work - let me know, but don't complain that I've screwed up your version
of majordomo!

Nick


-- 
Nick Perry   | Home / Recreation          | Work - AboarD Boats & Yachts
____________ | LONDON SW1, UK             | LONDON SW10 0TB     UK
Internet,    | http://www.amulation.co.uk | http://www.aboard.co.uk
Musicals,    | nick@amulation.co.uk       | np@aboard.co.uk
Theatre,     -----------------------------------------------------------
Coffee, Tea, Multimedia, Macs, Photography, Print Publishing, etc, etc..
--- digest.orig	Thu Dec  5 19:00:55 1996
+++ digest	Fri Apr 11 17:09:54 1997
@@ -198,9 +198,17 @@
 	    close(message);
 
 	    # escape ^From <user> <weekday> <month> <day> <hr:min:sec> ...
+	    if ($RMHEADER) {
+	      $body =~ s/$RMHEADER/\n/;
+	    }
+	    if ($RMTRAILER) {
+	      $body =~ s/$RMTRAILER/\n/;
+	    }
+
 	    $body =~
 		s/^From (\S+\s+\w{3}\s+\w{3}\s+\d+\s+\d+:\d+:\d+)/>From $1/g;
 	    $body =~ s/^-/- -/g; # escape encapsulation boundaries in message
+
 	    # trim trailing \n's
 	    $len = length($body) - 1;
 	    $len-- while (substr($body,$len,1) eq "\n");
@@ -347,6 +355,28 @@
 
 		# get the digest config file
 		&get_config($listdir, $opt_l);
+
+		# get details of parent list footers and headers
+		if ($config_opts{$opt_l,"digest_rm_fronter"}) {
+		  &get_config($listdir, $config_opts{$opt_l,"digest_rm_fronter"});
+		  $RMHEADER = $config_opts{$config_opts{$opt_l,"digest_rm_fronter"},
+		                           "message_fronter"};
+		  $RMHEADER =~ s/([^A-Za-z0-9 \001])/\\\1/g;
+		  $RMHEADER =~ s/\\\$(SENDER|VERSION|LIST)/\[\^\\n\]\*/g;
+		  $RMHEADER =~ s/\001/\\n/g;
+		}
+		if ($config_opts{$opt_l,"digest_rm_footer"}) {
+		  if ($config_opts{$opt_l,"digest_rm_footer"} ne 
+		        $config_opts{$opt_l,"digest_rm_fronter"}) {
+		    &get_config($listdir, $config_opts{$opt_l,"digest_rm_footer"});
+		  }
+		  $RMTRAILER = $config_opts{$config_opts{$opt_l,"digest_rm_footer"},
+		                           "message_footer"};
+		  $RMTRAILER =~ s/([^A-Za-z0-9 \001])/\\\1/g;
+		  $RMTRAILER =~ s/\\\$(SENDER|VERSION|LIST)/\[\^\\n\]\*/g;
+		  $RMTRAILER =~ s/\001/\\n/g;
+		}
+
 
 		# map config opts to internal variables and $V array
 		$HEADER = $config_opts{$opt_l,"message_fronter"};
--- config_parse.pl.orig	Thu Apr 10 14:24:36 1997
+++ config_parse.pl	Fri Apr 11 17:12:48 1997
@@ -374,12 +374,10 @@
 'digest_rm_footer', "The value is the name of the list that applies
 the header and footers to the messages that are received by
 digest. This allows the list supplied headers and footers to be
-stripped before the messages are included in the digest. This keyword
-is currently non operative.",
+stripped before the messages are included in the digest.",
 
 'digest_rm_fronter',
-'Works just like digest_rm_footer, except it removes the front material.
-Just like digest_rm_footer, it is also non-operative.',
+'Works just like digest_rm_footer, except it removes the front material.',
 
 'digest_maxlines',
 "automatically generate a new digest when the size of the digest exceeds
Indexed By Date Previous: Re: Possible DOS attack
From: "Roger B.A. Klorese" <rogerk@QueerNet.ORG>
Next: Re: mkdigest error
From: Dave Wolfe <dwolfe@risc.sps.mot.com>
Indexed By Thread Previous: Re: mkdigest error
From: Dave Wolfe <dwolfe@risc.sps.mot.com>
Next: Problem with From: header
From: Minh Nguyen ~ <minh@gomez.sc.intel.com>

Google
 
Search Internet Search www.greatcircle.com