Accéder au contenu.
Menu Sympa

fr - Re: [sympa-fr] Accumulation de « Re : » en sujet des messages

Objet : Pour les administrateurs de serveurs de listes utilisant le logiciel Sympa

Archives de la liste

Chronologique Discussions  
  • From: David Prévot <adresse@cachée>
  • To: adresse@cachée
  • Subject: Re: [sympa-fr] Accumulation de « Re : » en sujet des messages
  • Date: Mon, 30 Nov 2009 19:58:22 -0400

Cyril Quémeras a écrit :
> Bonsoir David, bonsoir à tous,

Bonsoir Cyril et les autres,

>>> Nous avons installé Sympa (5.3.4) sur Debian Lenny avec Exim
> [...]

>> C'est un pb corrigé dans les versions ultérieures de Sympa. (les
>> versions 5.3 ont été arrétées en 2007)
>
> Merci, j'ai intégré le traitement du sujet de la version 5.4.7
[...]

> Peux-tu m'indiquer quel patch tu as appliqué STP ?

En pièce jointe, le résultat d'un « diff -u ». J'ai juste remplacé le
traitement du sujet par celui de la version 5.4.7 (actuellement dans Sid
et Squeeze). Réponse sur la liste, vu que le fichier fait moins de 5 ko.

Amicalement

David

--- /usr/lib/sympa/bin/List.pm 2008-10-19 17:37:24.000000000 -0400
+++ /mnt/donnees/Important/globenet/home/taffit/List.pm 2009-10-21
15:54:23.000000000 -0400
@@ -2381,38 +2381,57 @@

## Search previous subject tagging in Subject
my $custom_subject = $self->{'admin'}{'custom_subject'};
- my $tag_regexp = $custom_subject;
- $tag_regexp =~ s/([\[\]\*\-\(\)\+\{\}\?])/\\$1/g; ## cleanup, just
in case dangerous chars were left
- $tag_regexp =~ s/\[\S+\]/\.\+/g;
- $tag_regexp =~ s/\s+/\\s+/g; ## consider folding
-
- ## Add subject tag
- $message->{'msg'}->head->delete('Subject');
- my $parsed_tag;
- &tt2::parse_tt2({'list' => {'name' => $self->{'name'},
- 'sequence' => $self->{'stats'}->[0]
- }},
- [$custom_subject], \$parsed_tag);
-
- ## If subject is tagged, replace it with new tag
- $subject_field =~ s/\s*\[$tag_regexp\]//;
- ## Encode subject using initial charset
-
- ## Don't try to encode the subject if it was not originaly encoded
non-ASCII.
- if ($message->{'subject_charset'} or $subject_field !~
/[^\x00-\x7E]/) {
- $subject_field = MIME::EncWords::encode_mimewords([
-
[Encode::decode('utf8', '['.$parsed_tag.'] '), &Language::GetCharset()],
-
[Encode::decode('utf8', $subject_field), $message->{'subject_charset'}]
- ],
Encoding=>'A', Field=>'Subject');
- }else {
- $subject_field = MIME::EncWords::encode_mimewords([
-
[Encode::decode('utf8', '['.$parsed_tag.']'), &Language::GetCharset()]
- ],
Encoding=>'A', Field=>'Subject') . ' ' . $subject_field;
- }
+
+ ## Remove unwanted headers if present.
+ ## tag_regexp will be used to remove the custom subject if it is
already present in the message subject.
+ ## Remember that the value of custom_subject can be "dude number
[%list.sequence"%]" whereas the actual
+ ## subject will contain "dude number 42".
+ my $tag_regexp = $custom_subject;
+ $tag_regexp =~ s/([\[\]\*\-\(\)\+\{\}\?])/\\$1/g; ## cleanup, just
in case dangerous chars were left
+ $tag_regexp =~ s/\\\[%\S+%\\\]/[^\]]\+/g; ## Replaces variables
declarations by "[^\]]+"
+ $tag_regexp =~ s/\s+/\\s+/g; ## Takes spaces into account
+
+ ## Add subject tag
+ $message->{'msg'}->head->delete('Subject');
+ my $parsed_tag;
+ &tt2::parse_tt2({'list' => {'name' => $self->{'name'},
+ 'sequence' => $self->{'stats'}->[0]
+ }},
+ [$custom_subject], \$parsed_tag);
+
+ ## If subject is tagged, replace it with new tag
+ ## Splitting the subject in two parts :
+ ## - what is before the custom subject (probably some "Re:")
+ ## - what is after it : the orginal subject sent to the list.
+ ## The custom subject is not kept.
+ my $before_tag = '';
+ my $after_tag = $subject_field;
+ $after_tag =~ s/.*\[$tag_regexp\]//;
+
+ if($subject_field =~ /(.*)\s*\[$tag_regexp\](.*)/) {
+ $before_tag = $1;
+ $after_tag = $2;
+ $after_tag =~ s/^\s*(.*)\s*$/$1/; ## Remove leading and trailing
blanks
+ }
+
+ ## Encode subject using initial charset

- $message->{'msg'}->head->add('Subject', $subject_field);
+ ## Don't try to encode the subject if it was not originaly encoded
non-ASCII.
+ if ($message->{'subject_charset'} or $subject_field !~
/[^\x00-\x7E]/) {
+ $subject_field = MIME::EncWords::encode_mimewords([
+
[Encode::decode('utf8', $before_tag), $message->{'subject_charset'}],
+
[Encode::decode('utf8', '['.$parsed_tag.'] '), &Language::GetCharset()],
+
[Encode::decode('utf8', $after_tag), $message->{'subject_charset'}]
+ ],
Encoding=>'A', Field=>'Subject');
+ }else {
+ $subject_field = $before_tag . ' ' .
MIME::EncWords::encode_mimewords([
+
[Encode::decode('utf8', '['.$parsed_tag.']'), &Language::GetCharset()]
+
], Encoding=>'A', Field=>'Subject') . ' ' . $after_tag;
+ }
+
+ $message->{'msg'}->head->add('Subject', $subject_field);
}
-
+
## Remove unwanted headers if present.
if ($Conf{'remove_headers'}) {
foreach my $field (@{$Conf{'remove_headers'}}) {

Attachment: signature.asc
Description: OpenPGP digital signature




Archives gérées par MHonArc 2.6.19+.

Haut de le page