blob: 86d863985c281b53c6c4663b981654af4409da61 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/usr/bin/env perl
#-*- perl -*-
#
# Copyright (C) 2001,2002,2004,2006 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.5 2010/03/06 13:18:40 fukachan Exp $
#
use strict;
use Carp;
my $mode = $ENV{ MODE } || "post";
my $from = $ENV{ FML_EMUL_FROM } || undef;
my $from_found = 0;
my $date_found = 0;
my $msgid_found = 0;
# unix from
print "From $from\n";
# main part
while (<>) {
if (/^date:/i) {
$date_found = 1;
}
if (/^message-id/i) {
my $time = time;
s/\d+/$time.$$/g;
$msgid_found = 1;
}
if (defined($from) && /^From:/ && (not $from_found)) {
s/\S+\@\S+/$from/;
$from_found = 1;
}
if (/^$/) {
unless ($msgid_found) {
my $time = time;
my $host = `hostname`; chomp $host;
print "Message-ID: <$time\@$host>\n";
$msgid_found = 1;
}
unless ($date_found) {
print "Date: ";
print `date +"%a, %d %b %Y %H:%M:%S +0900 (JST)."`;
$date_found = 1;
}
}
print $_;
}
if ($mode eq "post") {
# avoid body loop check.
# require 'ctime.pl';
use Time::localtime;
print "\n";
print "XXX AVOID BODY CHECKSUM LOOP CHECK: ";
print ctime(time);
print "\n";
}
exit 0;
|