Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | ##---------------------------------------------------------------------------## |
2 | ## File: | |
3 | ## $Id: mhsingle.pl,v 1.6 2001/08/25 19:56:59 ehood Exp $ | |
4 | ## Author: | |
5 | ## Earl Hood mhonarc@mhonarc.org | |
6 | ## Description: | |
7 | ## Routines for converting a single message to HTML | |
8 | ##---------------------------------------------------------------------------## | |
9 | ## MHonArc -- Internet mail-to-HTML converter | |
10 | ## Copyright (C) 1995-2001 Earl Hood, mhonarc@mhonarc.org | |
11 | ## | |
12 | ## This program is free software; you can redistribute it and/or modify | |
13 | ## it under the terms of the GNU General Public License as published by | |
14 | ## the Free Software Foundation; either version 2 of the License, or | |
15 | ## (at your option) any later version. | |
16 | ## | |
17 | ## This program is distributed in the hope that it will be useful, | |
18 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ## GNU General Public License for more details. | |
21 | ## | |
22 | ## You should have received a copy of the GNU General Public License | |
23 | ## along with this program; if not, write to the Free Software | |
24 | ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
25 | ## 02111-1307, USA | |
26 | ##---------------------------------------------------------------------------## | |
27 | ||
28 | package mhonarc; | |
29 | ||
30 | ##--------------------------------------------------------------------------- | |
31 | ## Routine to perform conversion of a single mail message to | |
32 | ## HTML. | |
33 | ## | |
34 | sub single { | |
35 | my($handle, $filename); | |
36 | ||
37 | ## Prevent any verbose output | |
38 | $QUIET = 1; | |
39 | ||
40 | ## See where input is coming from | |
41 | if ($ARGV[0]) { | |
42 | ($handle = file_open($ARGV[0])) || | |
43 | die("ERROR: Unable to open $ARGV[0]\n"); | |
44 | $filename = $ARGV[0]; | |
45 | } else { | |
46 | $handle = $MhaStdin; | |
47 | } | |
48 | ||
49 | ## Read header | |
50 | my($index, $fields) = read_mail_header($handle); | |
51 | ## Read rest of message | |
52 | $Message{$index} = read_mail_body($handle, $index, $fields); | |
53 | ||
54 | ## Set index list structures for replace_li_var() | |
55 | @MListOrder = sort_messages(); | |
56 | %Index2MLoc = (); | |
57 | @Index2MLoc{@MListOrder} = (0 .. $#MListOrder); | |
58 | ||
59 | ## Output mail | |
60 | if ($DoArchive) { | |
61 | output_mail($index, 1, 0); | |
62 | } | |
63 | ||
64 | close($handle) unless -t $handle; | |
65 | } | |
66 | ||
67 | ##--------------------------------------------------------------------------- | |
68 | 1; |