Subject: Developers of Sympa
List archive
- From: Janek Hiis <address@concealed>
- To: <address@concealed>
- Subject: [PATCH] numbers on subject line
- Date: Thu, 21 Mar 2002 16:20:31 +0200 (EET)
Hi,
would you please consider including this patch ...
This patch does two things
1. adds a new parameter that can be used with custom_header - $SEQNUM
if this keyword is found in custom_header this will be replaced with
the message number
2. when replying to messages with custom header it removes the previous
custom header and adds new one. Check is done based on wheter subject
starts with "Re: "
Janek Hiis
Index: List.pm
===================================================================
RCS file: /home/sympa/cvsroot/sympa/src/List.pm,v
retrieving revision 1.247
diff -u -3 -p -u -r1.247 List.pm
--- List.pm 2002/02/27 09:18:40 1.247
+++ List.pm 2002/03/21 14:15:58
@@ -1904,13 +1904,48 @@ sub send_msg {
## Add Custom Subject
if ($admin->{'custom_subject'}) {
- my $tag = '['.$admin->{'custom_subject'}.']';
+ my $tag = $admin->{'custom_subject'};
+
my $subject_field = $msg->head->get('Subject');
$subject_field =~ s/^\s*(.*)\s*$/$1/;
- if (index(&MIME::Words::decode_mimewords($subject_field), $tag) <0) {
- $msg->head->delete('Subject');
- $msg->head->add('Subject', $tag." ".$subject_field);
+ my $raw_subject = &MIME::Words::decode_mimewords($subject_field);
+
+ my $newtag=$tag;
+ $newtag =~ s/\$SEQNUM//;
+ $newtag = quotemeta($newtag);
+
+ my $number = $msg->head->get('X-Sequence');
+ $number =~ s/^\s*(.*)\s*$/$1/;
+ $tag =~ s/\$SEQNUM/$number/;
+
+ $_ = $raw_subject;
+ if (/(.*)\[$newtag.*\](.*)/) {
+ my $before = $1;
+ my $after = $2;
+ my $re = 0;
+
+ $_ = $before;
+ if (/(.*re:.*)+/i) {
+ $re = 1;
+ }
+
+ $_ = $after;
+ if (/(.*re:)+(.*)/i) {
+ $re = 1;
+ $after = $2;
+ }
+
+ $after =~ s/^\s*//;
+ if ($re) {
+ $after = 'Re: '.$after;
+ }
+ $subject_field = '['.$tag.'] '.$after;
+ } else {
+ $subject_field = '['.$tag.'] '.$raw_subject;
}
+
+ $msg->head->delete('Subject');
+ $msg->head->add('Subject', $subject_field);
}
## Who is the enveloppe sender ?
-
[PATCH] numbers on subject line,
Janek Hiis, 03/21/2002
- Re: [sympa-dev] [PATCH] numbers on subject line, Olivier Salaun, 03/22/2002
Archive powered by MHonArc 2.6.19+.