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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#!/usr/local/bin/perl
#
# cmail-r2c.pl - RMAIL Υե chain-mail Folder ηѹ
#
# Author: nagano@ose.west.enicom.co.jp ( Takashi Nagano )
#
# ver 0.2 - Date: Wed, 10 Nov 93 20:19:00
# ̤ɤ RMAIL եФ륳СȤǽˤˡξ
# ˹碌ơchain-mail status-line դ褦ˤ
#
# ver 0.1 - Date: Mon, 8 Nov 93 10:38:00
# Ȥꤢɤ RMAIL եʤ顢СȤǤ褦
# ˤ
#############################################################################
#
# ʸν
#
# ƴĶˤ碌ѹƤ
#
#############################################################################
# rmail γ mail ֤Υѥ졼
$PAGE_SEP = "\n";
# rmail file last-border
$LAST_SEP = "";
# rmail mail-header ʬʸΥѥ졼
$MH_SEP = "*** EOOH ***\n";
# cmail status-line
# ( ϡcmail status-line ˤ碌Ƥ )
$CM_RLINE = "X-cmail-status: Replied\n";
$CM_ULINE = "X-cmail-status: Unread\n";
$CM_ALINE = "X-cmail-status: Active\n";
#############################################################################
#
# ץ
#
#############################################################################
#
# Ϥ줿 file rmail ɤ check
#
$_ = <STDIN>;
if ( $_ !~ /^BABYL/ ) {
die "Input file in not in format of RMAIL.\n";
}
#
# rmail header skip
#
do {
$_ = <>;
} until$_ eq $PAGE_SEP ;
print $PAGE_SEP;
#
# Ѵγ
#
while (<>) {
# rmail Ѥ status-line β
if ( /unseen/ ) { # ̤ɤξ
print $CM_ULINE; # cmail status-line ν
while (<>) {
last if ($_ eq $MH_SEP);
}
$_ = <>;
} else { # ɤξ
if ( /(forwarded|answered)/ ) { # ֻФƤ
print $CM_RLINE; # cmail status-line ν
} else { # ɤǡֻϤƤʤ
print $CM_ALINE; # cmail status-line ν
}
while (<>) { # mail-header ʬν
print;
last if ( /^\n/ );
}
while (<>) { # mail-header ʣʬ skip
last if ( /^\n/ );
}
}
# mail ʸν
# (̤ɤξϡmail-header Ʊ˽Ϥ롣)
do {
print;
$_ = <>;
} until ( $_ eq $PAGE_SEP || $_ eq $LAST_SEP );
print $PAGE_SEP;
}
|