Skip to Content.
Sympa Menu

en - Re: [sympa-users] Digest bugs

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Chris Hastie <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-users] Digest bugs
  • Date: Fri, 6 Feb 2004 18:04:13 +0000

On Fri, 6 Feb 2004, Chris Hastie <address@concealed> wrote
>Digging around in sub send_msg_digest this morning I noticed a slight
>bug, and testing my theory that this would be a problem encountered a
>second one.

and not wanting to be all criticism and no construction, here's a patch
that deals with some of these issues. The Subject and From header fields
of attached messages is now retained as they were when they arrived -
only the TOC is decoded. The decoding produces 8bit ISO-8859-1
characters, with characters from other character sets above 127 replaced
by a '?'.

To go with this, the digest template should be altered to declare 8bit
ISO-8859-1 for the TOC.

--- List.pm.orig Thu Feb 5 17:56:44 2004
+++ List.pm Fri Feb 6 17:41:30 2004
@@ -193,6 +193,7 @@
use Time::Local;
use MIME::Entity;
use MIME::Words;
+use MIME::WordDecoder;
use MIME::Parser;
use Message;

@@ -2537,39 +2538,54 @@
splice @list_of_mail, 0, 1;

## Headers cleanup
- foreach $i (0 .. $#list_of_mail){
- my $mail = $list_of_mail[$i];
- my ($subject, $from);
-
- ## Subject cleanup
- if ($subject =
&MIME::Words::decode_mimewords($mail->head->get('Subject'))) {
- $mail->head->replace('Subject', $subject);
- }
-
- ## From cleanup
- if ($from = &MIME::Words::decode_mimewords($mail->head->get('From')))
{
- $mail->head->replace('From', $from);
- }
- }
+### Moved to keep messages intact ###
+# foreach $i (0 .. $#list_of_mail){
+# my $mail = $list_of_mail[$i];
+# my ($subject, $from);
+#
+# ## Subject cleanup
+# if ($subject =
&MIME::Words::decode_mimewords($mail->head->get('Subject'))) {
+# $mail->head->replace('Subject', $subject);
+# }
+#
+# ## From cleanup
+# if ($from = &MIME::Words::decode_mimewords($mail->head->get('From')))
{
+# $mail->head->replace('From', $from);
+# }
+# }

- my @topics;
- push @topics, sprintf(Msg(8, 13, "Table of content"));
- push @topics, sprintf(" :\n\n");
+ ### @topics appears to be redundant now??
+ #my @topics;
+ #push @topics, sprintf(Msg(8, 13, "Table of content"));
+ #push @topics, sprintf(" :\n\n");

## Digest index
foreach $i (0 .. $#list_of_mail){
my $mail = $list_of_mail[$i];
my $subject = $mail->head->get('Subject');
+
+ ## clean up subject for TOC
+ my $wdecode = new MIME::WordDecoder::ISO_8859 (1);
+ unless ($subject = $wdecode->decode($subject)) {
+ $subject = "???????";
+ }
chomp $subject;
+
+ ## clean up from for TOC
+ my $from = $mail->head->get('From');
+ unless ($from = $wdecode->decode($from)) {
+ $from = "???????";
+ }
+ chomp $from;
+
my $msg = {};
$msg->{'id'} = $i+1;
$msg->{'subject'} = $subject;
- $msg->{'from'} = $mail->head->get('From');
+ $msg->{'from'} = $from;
$mail->tidy_body;
$mail->remove_sig;
$msg->{'full_msg'} = $mail->as_string;
$msg->{'body'} = $mail->body;
- chomp $msg->{'from'};
$msg->{'month'} = &POSIX::strftime("%Y-%m", localtime(time)); ##
Should be extracted from Date:
$msg->{'message_id'} = $mail->head->get('Message-Id');

@@ -2579,7 +2595,7 @@

push @{$param->{'msg_list'}}, $msg ;

- push @topics, sprintf ' ' x (2 - length($i)) . "%d. %s", $i+1,
$subject;
+ # push @topics, sprintf ' ' x (2 - length($i)) . "%d. %s", $i+1,
$subject;
}

## Prepare Digest


and for the template:

--- bin/etc/templates/digest.us.tpl Thu Jan 29 21:26:44 2004
+++ etc/templates/digest.us.tpl Fri Feb 6 17:59:40 2004
@@ -6,8 +6,8 @@
Content-Type: multipart/mixed; boundary="[boundary1]"

--[boundary1]
-Content-Type: text/plain
-Content-transfer-encoding: 7bit
+Content-Type: text/plain; charset=iso-8859-1;
+Content-transfer-encoding: 8bit

Table of contents:

--
Chris Hastie



Archive powered by MHonArc 2.6.19+.

Top of Page