summaryrefslogtreecommitdiff
path: root/regress/message/scramble.pl
blob: cc1bdb02848f094f6030a8219b437c19abdd0707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env perl
#-*- perl -*-
#
#  Copyright (C) 2001,2002 Ken'ichi Fukamachi
#   All rights reserved. This program is free software; you can
#   redistribute it and/or modify it under the same terms as Perl itself. 
#
# $FML: scramble.pl,v 1.1 2001/04/14 14:35:08 fukachan Exp $
#

use strict;
use Carp;

my $from = undef;
my $from_found = 0;

if (defined $ENV{ FML_EMUL_FROM }) {
    $from = $ENV{ FML_EMUL_FROM };
} 

while (<>) {
    if (/message-id/i) {
	my $time = time;
	s/\d+/$time.$$/g;
    }

    if (defined($from) && /^From:/ && (not $from_found)) {
	s/\S+\@\S+/$from/;
	$from_found = 1;
    }

    print $_;
}

exit 0;