mhinit.pl untested

filter: Statementstmt 0.0% 0 / 319 Branchbran 0.0% 0 / 124 Conditioncond 0.0% 0 / 107 MC/DCmcdc 0.0% 0 / 56 Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 608 CC 54 SCAR 80.0
CC
54
Cov
0%
mhinit_vars
2970.0
CRAP 2970.0
1 ##---------------------------------------------------------------------------##
2 ## File:
3 ## $Id: mhinit.pl,v 2.57 2011/01/09 07:52:25 ehood Exp $
4 ## Author:
5 ## Earl Hood mhonarc@mhonarc.org
6 ## Description:
7 ## Initialization stuff for MHonArc.
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 ## Callbacks
32 ## We only declare once so custom front-ends do not have to
33 ## re-register each time. This basically serves as a summary
34 ## of the callbacks available.
35 ##---------------------------------------------------------------------------##
36  
37 ## After message body is read and converted:
38 ## &invoke($fields_hash_ref, $html_text_ref, $files_array_ref);
39 $CBMessageBodyRead = undef
40 unless defined($CBMessageBodyRead);
41  
42 ## Right before database file is loaded:
43 ## $do_load = &invoke($pathname);
44 $CBDbPreLoad = undef
45 unless defined($CBDbPreLoad);
46  
47 ## Right before database file is written:
48 ## $do_save = &invoke($pathname, $tmp_pathname);
49 $CBDbPreSave = undef
50 unless defined($CBDbPreSave);
51  
52 ## When data has been written:
53 ## $do_save = &invoke($db_fh);
54 $CBDbSave = undef
55 unless defined($CBDbSave);
56  
57 ## After message header is parsed:
58 ## $do_not_exclude = &invoke($fields_hash_ref, $raw_header_txt);
59 $CBMessageHeadRead = undef
60 unless defined($CBMessageHeadRead);
61  
62 ## After message body is read from input
63 ## &invoke($fields_hash_ref, $raw_data_ref);
64 $CBRawMessageBodyRead = undef
65 unless defined($CBRawMessageBodyRead);
66  
67 ## After a message has been converted
68 ## &$invoke($fields, +{ folder => $filename, file => $filename });
69 $CBMessageConverted = undef
70 unless defined($CBMessageConverted);
71  
72 ## After a mail folder has been read
73 ## &invoke($filename);
74 $CBMailFolderRead = undef
75 unless defined($CBMailFolderRead);
76  
77 ## When a resource variable is being expanded:
78 ## ($result, $recurse, $canclip) = &invoke($index, $varname, $arg);
79 $CBRcVarExpand = undef
80 unless defined($CBRcVarExpand);
81  
82 ##---------------------------------------------------------------------------##
83  
84 sub mhinit_vars {
85  
86 ## The %Zone array should be augmented to contain all timezone
87 ## specifications with the positive/negative hour offset from UTC
88 ## (GMT). The zone value is *added* to the time containing the
89 ## zone to determine GMT time. Hence, the values will be the
90 ## negative inverse used in actual time specifications in messages.
91 ## (There has got to be a better way to handle timezones)
92 ## Array can be augmented/overridden via the resource file.
93 %Zone = (
94 'ACDT', '-1030', # Australian Central Daylight
95 'ACST', '-0930', # Australian Central Standard
96 'ADT', '0300', # (US) Atlantic Daylight
97 'AEDT', '-1100', # Australian East Daylight
98 'AEST', '-1000', # Australian East Standard
99 'AHDT', '0900',
100 'AHST', '1000',
101 'AST', '0400', # (US) Atlantic Standard
102 'AT', '0200', # Azores
103 'AWDT', '-0900', # Australian West Daylight
104 'AWST', '-0800', # Australian West Standard
105 'BAT', '-0300', # Baghdad
106 'BDST', '-0200', # British Double Summer
107 'BET', '1100', # Bering Standard
108 'BST', '-0100', # British Summer
109 # 'BST', '0300', # Brazil Standard
110 'BT', '-0300', # Baghdad
111 'BZT2', '0300', # Brazil Zone 2
112 'CADT', '-1030', # Central Australian Daylight
113 'CAST', '-0930', # Central Australian Standard
114 'CAT', '1000', # Central Alaska
115 'CCT', '-0800', # China Coast
116 'CDT', '0500', # (US) Central Daylight
117 'CED', '-0200', # Central European Daylight
118 'CET', '-0100', # Central European
119 'CST', '0600', # (US) Central Standard
120 'EAST', '-1000', # Eastern Australian Standard
121 'EDT', '0400', # (US) Eastern Daylight
122 'EED', '-0300', # Eastern European Daylight
123 'EET', '-0200', # Eastern Europe
124 'EEST', '-0300', # Eastern Europe Summer
125 'EST', '0500', # (US) Eastern Standard
126 'FST', '-0200', # French Summer
127 'FWT', '-0100', # French Winter
128 'GMT', '0000', # Greenwich Mean
129 'GST', '-1000', # Guam Standard
130 # 'GST', '0300', # Greenland Standard
131 'HDT', '0900', # Hawaii Daylight
132 'HST', '1000', # Hawaii Standard
133 'IDLE', '-1200', # Internation Date Line East
134 'IDLW', '1200', # Internation Date Line West
135 'IST', '-0530', # Indian Standard
136 'IT', '-0330', # Iran
137 'JST', '-0900', # Japan Standard
138 'JT', '-0700', # Java
139 'KST', '-0900', # Korean Standard
140 'MDT', '0600', # (US) Mountain Daylight
141 'MED', '-0200', # Middle European Daylight
142 'MET', '-0100', # Middle European
143 'MEST', '-0200', # Middle European Summer
144 'MEWT', '-0100', # Middle European Winter
145 'MST', '0700', # (US) Mountain Standard
146 'MT', '-0800', # Moluccas
147 'NDT', '0230', # Newfoundland Daylight
148 'NFT', '0330', # Newfoundland
149 'NT', '1100', # Nome
150 'NST', '-0630', # North Sumatra
151 # 'NST', '0330', # Newfoundland Standard
152 'NZ', '-1100', # New Zealand
153 'NZST', '-1200', # New Zealand Standard
154 'NZDT', '-1300', # New Zealand Daylight
155 'NZT', '-1200', # New Zealand
156 'PDT', '0700', # (US) Pacific Daylight
157 'PST', '0800', # (US) Pacific Standard
158 'ROK', '-0900', # Republic of Korea
159 'SAD', '-1000', # South Australia Daylight
160 'SAST', '-0900', # South Australia Standard
161 'SAT', '-0900', # South Australia
162 'SDT', '-1000', # South Australia Daylight
163 'SST', '-0200', # Swedish Summer
164 'SWT', '-0100', # Swedish Winter
165 'USZ3', '-0400', # USSR Zone 3
166 'USZ4', '-0500', # USSR Zone 4
167 'USZ5', '-0600', # USSR Zone 5
168 'USZ6', '-0700', # USSR Zone 6
169 'UT', '0000', # Universal Coordinated
170 'UTC', '0000', # Universal Coordinated
171 'UZ10', '-1100', # USSR Zone 10
172 'WAT', '0100', # West Africa
173 'WET', '0000', # West European
174 'WST', '-0800', # West Australian Standard
175 'YDT', '0800', # Yukon Daylight
176 'YST', '0900', # Yukon Standard
177 'ZP4', '-0400', # USSR Zone 3
178 'ZP5', '-0500', # USSR Zone 4
179 'ZP6', '-0600', # USSR Zone 5
180 );
181 %ZoneUD = ();
182  
183 ## Assoc array listing mail header fields to exclude in output.
184 ## Each key is treated as a regular expression with '^' prepended
185 ## to it.
186  
187 %HFieldsExc = (
188 'content-', 1, # Mime headers
189 'errors-to', 1,
190 'forward', 1, # Forward lines (MH may add these)
191 'lines', 1,
192 'message-id', 1,
193 'mime-', 1, # Mime headers
194 'nntp-', 1,
195 'originator', 1,
196 'path', 1,
197 'precedence', 1,
198 'received', 1, # MTA added headers
199 'replied', 1, # Replied lines (MH may add these)
200 'return-path', 1, # MH/MTA header
201 'status', 1,
202 'via', 1,
203 'x-', 1, # Non-standard headers
204 );
205  
206 ## Hash defining HTML formats to apply to header fields
207 %HeadFields = ( # Nothing
208 "-default-", "",
209 );
210 %HeadHeads = ( # Empasize field labels
211 "-default-", "em",
212 );
213 @FieldOrder = ( # Order fields are listed
214 'to',
215 'subject',
216 'from',
217 'date',
218 '-extra-',
219 );
220 %FieldODefs = ( # Fields not to slurp up in "-extra-"
221 'to', 1,
222 'subject', 1,
223 'from', 1,
224 'date', 1,
225 );
226  
227 ## Extra header fields to store
228 @ExtraHFields = ();
229 %ExtraHFields = ();
230  
231 ## Message information variables
232  
233 $NewMsgCnt = 0; # Total number of new messages
234 $NumOfMsgs = 0; # Total number of messages
235 $LastMsgNum = -1; # Message number of last message
236 %Message = (); # Message indexes to bodies
237 %MsgHead = (); # Message indexes to heads
238 %MsgHtml = (); # Flag if message is html
239 %Subject = (); # Message indexes to subjects
240 %Time = (); # Message indexes to message unix date/time
241 %From = (); # Message indexes to froms
242 %Date = (); # Message indexes to dates
243 %MsgId = (); # Message ids to indexes
244 %NewMsgId = (); # New message ids to indexes
245 %IndexNum = (); # Index key to message number
246 %Derived = (); # Index key to derived files for message
247 %Refs = (); # Index key to message references
248 %Follow = (); # Index key to follow-ups
249 %FolCnt = (); # Index key to number of follow-ups
250 %ContentType = (); # Index key to base content-type of message
251 %Icons = (); # Index key to icon URL for content-type
252 %AddIndex = (); # Flags for messages that must be written
253  
254 $DoFromName = 1;
255 $DoFromAddr = 1;
256 %FromName = (); # Message indexes to from human name
257 %FromAddr = (); # Message indexes to from address
258  
259 @MListOrder = (); # List of indexes in order printed on main index
260 %Index2Mloc = (); # Map index to position in main index
261 @TListOrder = (); # List of indexes in order printed on thread index
262 %Index2Tloc = (); # Map index to position in thread index
263 %ThreadLevel = (); # Map index to thread level
264  
265 %UDerivedFile = (); # Key = filename template. Value = content template
266  
267 ## Following variables used in thread computation
268  
269 @ThreadList = (); # List of messages visible in thread index
270 @NotIdxThreadList = (); # List of messages not visible in index
271 %HasRef = (); # Flags if message has references (Keys = indexes)
272 # (Values = reference message indexes)
273 %HasRefDepth = (); # Depth of reference from HasRef value
274 %Replies = (); # Msg-ids of explicit replies (Keys = indexes)
275 %SReplies = (); # Msg-ids of subject-based replies (Keys = indexes)
276 %TVisible = (); # Message visible in thread index (Keys = indexes)
277 $DoMissingMsgs = 0; # Flag is missing messages should be noted in index
278  
279 ## Some miscellaneous variables
280  
281 %IsDefault = (); # Flags if certain resources are the default
282  
283 $bs = "\b"; # Used as a separator
284  
285 $MLCP = 0; # Main index contains included files flag
286 $SLOW = 0; # Save memory flag
287 $NumOfPages = 0; # Number of index pages
288 $NumOfPrintedPages = 0; # Number of printed index pages
289 $IdxMinPg = -1; # Starting page of index for updating
290 $TIdxMinPg = -1; # Starting page of thread index for updating
291 $IdxPageNum = 0; # Page to output if genidx
292 $DBPathName = ''; # Full pathname of database file
293  
294 ## Variable to hold function for converting message header text.
295 $MHeadCnvFunc = "mhonarc::htmlize";
296  
297 ## Regexp for variable detection
298 $VarExp = $ENV{'M2H_VARREGEX'};
299 $VarExp = '\$([^\$]*)\$' if !defined($VarExp) || $VarExp !~ /\S/;
300  
301 ## Regexp for address/msg-id detection: In the past we had
302 ## patterns that are more insync with RFC (2)822, but much
303 ## of the world today uses simplier syntax. Also, the more
304 ## general versions have serious performance problems on
305 ## large strings.
306 #$AddrExp = '\b[^()<>@,;:\/\s"\'&|]+@[^()<>@,;:\/\s"\'&|]+\b';
307 #$HAddrExp = '\b[^()<>@,;:\/\s"\'&|]+(?:@|&\#[xX]0*40;|&64;)[^()<>@,;:\/\s"\'&|]+\b';
308 $AddrExp = '\b[A-Za-z\d\-\.+%_]+@[A-Za-z\d.\-]+\.[A-Za-z]{2,4}\b';
309 $HAddrExp = $AddrExp;
310  
311 ## Text clipping function and source file: Set in mhopt.pl.
312 $TextClipFunc = undef;
313 $TextClipSrc = undef;
314  
315 ## Grab environment variable settings
316 ##
317 $AFS = $ENV{'M2H_AFS'} || 0;
318 $ANNOTATE = $ENV{'M2H_ANNOTATE'} || 0;
319 $DBFILE = $ENV{'M2H_DBFILE'}
320 || (($MSDOS || $VMS) ? "mhonarc.db" : ".mhonarc.db");
321 $DOCURL = $ENV{'M2H_DOCURL'}
322 || 'http://www.mhonarc.org/';
323 $IDXNAME = ""; # Set in get_resources()
324 $IDXPREFIX = $ENV{'M2H_IDXPREFIX'} || "mail";
325 $TIDXPREFIX = $ENV{'M2H_TIDXPREFIX'} || "thrd";
326 $IDXSIZE = $ENV{'M2H_IDXSIZE'} || 0;
327 $TIDXNAME = ""; # Set in get_resources()
328 $OUTDIR = $ENV{'M2H_OUTDIR'} || $CURDIR;
329 $TTITLE = $ENV{'M2H_TTITLE'} || "Mail Thread Index";
330 $TITLE = $ENV{'M2H_TITLE'} || "Mail Index";
331 $MAILTOURL = $ENV{'M2H_MAILTOURL'} || "";
332 $NewsUrl = $ENV{'M2H_NEWSURL'} || "";
333 $FROM = $ENV{'M2H_MSGSEP'} || '^From ';
334 $LOCKFILE = $ENV{'M2H_LOCKFILE'}
335 || (
336 $MSDOS ? "mhonarc.lck"
337 : $VMS ? "mhonarc_lck"
338 : ".mhonarc.lck"
339 );
340 $LOCKTRIES = $ENV{'M2H_LOCKTRIES'} || 10;
341 $LOCKDELAY = $ENV{'M2H_LOCKDELAY'} || 3;
342 $MAXSIZE = $ENV{'M2H_MAXSIZE'} || 0;
343 $TLEVELS = $ENV{'M2H_TLEVELS'} || 3;
344 $TSLICELEVELS = $ENV{'M2H_TSLICELEVELS'} || -1;
345 $MHPATTERN = $ENV{'M2H_MHPATTERN'} || '^\d+$';
346 $DefRcFile = $ENV{'M2H_DEFRCFILE'} || '';
347 $HtmlExt = $ENV{'M2H_HTMLEXT'} || "html";
348 $MsgPrefix = $ENV{'M2H_MSGPREFIX'} || "msg";
349 $DefRcName = $ENV{'M2H_DEFRCNAME'}
350 || (($MSDOS || $VMS) ? "mhonarc.mrc" : ".mhonarc.mrc");
351 $GzipExe = $ENV{'M2H_GZIPEXE'} || 'gzip';
352 $SpamMode = $ENV{'M2H_SPAMMODE'} || 0;
353 $MainRcDir = undef; # Set in read_resource_file()
354  
355 $GMTDateFmt = $ENV{'M2H_GMTDATEFMT'} || '';
356 $LocalDateFmt = $ENV{'M2H_LOCALDATEFMT'} || '';
357 $ExpireDate = $ENV{'M2H_EXPIREDATE'} || '';
358 $ExpireDateTime = 0;
359 $ExpireTime = $ENV{'M2H_EXPIREAGE'} || 0;
360  
361 $MsgGMTDateFmt = $ENV{'M2H_MSGGMTDATEFMT'} || '';
362 $MsgLocalDateFmt = $ENV{'M2H_MSGLOCALDATEFMT'} || '';
363  
364 $NoSubjectTxt = $ENV{'M2H_NOSUBJECTTXT'} || '[no subject]';
365  
366 $NoteDir = $ENV{'M2H_NOTEDIR'} || 'notes';
367  
368 $LockMethod = $ENV{'M2H_LOCKMETHOD'} || 'directory';
369 $LockMethod = set_lock_mode($LockMethod);
370  
371 $CONLEN = defined($ENV{'M2H_CONLEN'}) ? $ENV{'M2H_CONLEN'} : 0;
372 $MAIN = defined($ENV{'M2H_MAIN'}) ? $ENV{'M2H_MAIN'} : 1;
373 $MAXPGS = defined($ENV{'M2H_MAXPGS'}) ? $ENV{'M2H_MAXPGS'} : 0;
374 $MULTIIDX = defined($ENV{'M2H_MULTIPG'}) ? $ENV{'M2H_MULTIPG'} : 0;
375 $MODTIME = defined($ENV{'M2H_MODTIME'}) ? $ENV{'M2H_MODTIME'} : 0;
376 $NODOC = defined($ENV{'M2H_DOC'}) ? !$ENV{'M2H_DOC'} : 0;
377 $NOMAILTO = defined($ENV{'M2H_MAILTO'}) ? !$ENV{'M2H_MAILTO'} : 0;
378 $NoMsgPgs = defined($ENV{'M2H_MSGPGS'}) ? !$ENV{'M2H_MSGPGS'} : 0;
379 $NONEWS = defined($ENV{'M2H_NEWS'}) ? !$ENV{'M2H_NEWS'} : 0;
380 $NOSORT = defined($ENV{'M2H_SORT'}) ? !$ENV{'M2H_SORT'} : 0;
381 $NOURL = defined($ENV{'M2H_URL'}) ? !$ENV{'M2H_URL'} : 0;
382 $REVSORT = defined($ENV{'M2H_REVSORT'}) ? $ENV{'M2H_REVSORT'} : 0;
383 $SUBSORT = defined($ENV{'M2H_SUBSORT'}) ? $ENV{'M2H_SUBSORT'} : 0;
384 $AUTHSORT = defined($ENV{'M2H_AUTHSORT'}) ? $ENV{'M2H_AUTHSORT'} : 0;
385 $THREAD = defined($ENV{'M2H_THREAD'}) ? $ENV{'M2H_THREAD'} : 1;
386 $TNOSORT = defined($ENV{'M2H_TSORT'}) ? !$ENV{'M2H_TSORT'} : 0;
387 $TREVERSE = defined($ENV{'M2H_TREVERSE'}) ? $ENV{'M2H_TREVERSE'} : 0;
388 $TSUBSORT = defined($ENV{'M2H_TSUBSORT'}) ? $ENV{'M2H_TSUBSORT'} : 0;
389 $GzipFiles = defined($ENV{'M2H_GZIPFILES'}) ? $ENV{'M2H_GZIPFILES'} : 0;
390 $GzipLinks = defined($ENV{'M2H_GZIPLINKS'}) ? $ENV{'M2H_GZIPLINKS'} : 0;
391 $KeepOnRmm = defined($ENV{'M2H_KEEPONRMM'}) ? $ENV{'M2H_KEEPONRMM'} : 0;
392 $UseLocalTime =
393 defined($ENV{'M2H_USELOCALTIME'}) ? $ENV{'M2H_USELOCALTIME'} : 0;
394 $NoSubjectThreads =
395 defined($ENV{'M2H_SUBJECTTHREADS'}) ? !$ENV{'M2H_SUBJECTTHREADS'} : 0;
396 $SaveRsrcs =
397 defined($ENV{'M2H_SAVERESOURCES'}) ? $ENV{'M2H_SAVERESOURCES'} : 1;
398 $POSIXstrftime =
399 defined($ENV{'M2H_POSIXSTRFTIME'}) ? $ENV{'M2H_POSIXSTRFTIME'} : 0;
400 $AddrModifyBodies =
401 defined($ENV{'M2H_MODIFYBODYADDRESSES'})
402 ? $ENV{'M2H_MODIFYBODYADDRESSES'}
403 : undef;
404 $IconURLPrefix =
405 defined($ENV{'M2H_ICONURLPREFIX'}) ? $ENV{'M2H_ICONURLPREFIX'} : '';
406 $PrintXComments =
407 defined($ENV{'M2H_PRINTXCOMMENTS'}) ? $ENV{'M2H_PRINTXCOMMENTS'} : 1;
408  
409 if ($UNIX) {
410 eval {
411 $UMASK =
412 defined($ENV{'M2H_UMASK'})
413 ? $ENV{'M2H_UMASK'}
414 : sprintf("%o", umask);
415 };
416 }
417 $FilePerms = $ENV{'M2H_FILEPERMS'} || '0666';
418 $FilePermsOct = 0666;
419 $DbFilePerms = $ENV{'M2H_DBFILEPERMS'} || '0660';
420 $DbFilePermsOct = 0660;
421 $FollowSymlinks =
422 defined($ENV{'M2H_FOLLOWSYMLINKS'}) ? $ENV{'M2H_FOLLOWSYMLINKS'} : 0;
423  
424 $CheckNoArchive =
425 defined($ENV{'M2H_CHECKNOARCHIVE'}) ? $ENV{'M2H_CHECKNOARCHIVE'} : 0;
426 $DecodeHeads =
427 defined($ENV{'M2H_DECODEHEADS'}) ? $ENV{'M2H_DECODEHEADS'} : 0;
428 $DoArchive = defined($ENV{'M2H_ARCHIVE'}) ? $ENV{'M2H_ARCHIVE'} : 1;
429 $DoFolRefs = defined($ENV{'M2H_FOLREFS'}) ? $ENV{'M2H_FOLREFS'} : 1;
430 $Reconvert = defined($ENV{'M2H_RECONVERT'}) ? $ENV{'M2H_RECONVERT'} : 0;
431 $UsingLASTPG =
432 defined($ENV{'M2H_USINGLASTPG'}) ? $ENV{'M2H_USINGLASTPG'} : 1;
433  
434 $FastTempFiles =
435 defined($ENV{'M2H_FASTTEMPFILES'}) ? $ENV{'M2H_FASTTEMPFILES'} : 0;
436  
437 $Lang = $ENV{'M2H_LANG'} || $ENV{'LC_ALL'} || $ENV{'LANG'} || undef;
438  
439 @FMTFILE = defined($ENV{'M2H_RCFILE'}) ? ($ENV{'M2H_RCFILE'}) : ();
440 @OtherIdxs =
441 defined($ENV{'M2H_OTHERINDEXES'})
442 ? split(/:/, $ENV{'M2H_OTHERINDEXES'})
443 : ();
444 @PerlINC =
445 defined($ENV{'M2H_PERLINC'}) ? split(/:/, $ENV{'M2H_PERLINC'}) : ();
446 @DateFields =
447 defined($ENV{'M2H_DATEFIELDS'})
448 ? split(/:/, $ENV{'M2H_DATEFIELDS'})
449 : ();
450 @FromFields =
451 defined($ENV{'M2H_FROMFIELDS'})
452 ? split(/:/, $ENV{'M2H_FROMFIELDS'})
453 : ();
454  
455 # Version of @Datefiles in parsed format
456 @_DateFields = ();
457  
458 ($TSliceNBefore, $TSliceNAfter, $TSliceInclusive) =
459 defined($ENV{'M2H_TSLICE'})
460 ? split(/[:;]/, $ENV{'M2H_TSLICE'})
461 : (0, 4, 0);
462  
463 ## Code for modify addresses in headers
464 $AddressModify = $ENV{'M2H_ADDRESSMODIFYCODE'} || "";
465  
466 ## Regex representing "article" words for stripping out when doing
467 ## subject sorting.
468 $SubArtRxp = $ENV{'M2H_SUBJECTARTICLERXP'}
469 || q/^(the|a|an)\s+/;
470  
471 ## Regex representing reply/forward prefixes to subject.
472 $SubReplyRxp = $ENV{'M2H_SUBJECTREPLYRXP'}
473 || q/^\s*(re|sv|fwd|fw)[\[\]\d]*[:>-]+\s*/;
474  
475 ## Code for stripping subjects
476 $SubStripCode = $ENV{'M2H_SUBJECTSTRIPCODE'} || "";
477  
478 $MsgExcFilter = $ENV{'M2H_MSGEXCFILTER'} || "";
479  
480 ## Arrays for months and weekdays. If empty, the default settings
481 ## in mhtime.pl are used.
482  
483 @Months = $ENV{'M2H_MONTHS'} ? split(/:/, $ENV{'M2H_MONTHS'}) : ();
484 @months = $ENV{'M2H_MONTHSABR'} ? split(/:/, $ENV{'M2H_MONTHSABR'}) : ();
485 @Weekdays = $ENV{'M2H_WEEKDAYS'} ? split(/:/, $ENV{'M2H_WEEKDAYS'}) : ();
486 @weekdays =
487 $ENV{'M2H_WEEKDAYSABR'} ? split(/:/, $ENV{'M2H_WEEKDAYSABR'}) : ();
488  
489 ## Location to put attachments.
490  
491 $AttachmentDir = $ENV{'M2H_ATTACHMENTDIR'};
492 $AttachmentUrl = $ENV{'M2H_ATTACHMENTURL'} || '';
493  
494 ## Many of the following are set during runtime after the
495 ## database and resources have been read. The variables are
496 ## listed here as a quick reference.
497  
498 $ADDSINGLE = 0; # Flag if adding a single message
499 $IDXONLY = 0; # Flag if generating index to stdout
500 $RMM = 0; # Flag if removing messages
501 $SCAN = 0; # Flag if doing an archive scan
502  
503 $MSGPGSSMARKUP = ''; # Initial markup of message pages
504 $IDXPGSSMARKUP = ''; # Initial markup of index pages
505 $TIDXPGSSMARKUP = ''; # Initial markup of thread index pages
506 $SSMARKUP = ''; # (Default) initial markup of all pages
507  
508 $IDXLABEL = ''; # Label for main index
509 $LIBEG = ''; # List open template for main index
510 $LIEND = ''; # List close template for main index
511 $LITMPL = ''; # List item template
512 $AUTHBEG = ''; # Begin of author group
513 $AUTHEND = ''; # End of author group
514 $DAYBEG = ''; # Begin of a day group
515 $DAYEND = ''; # End of a day group
516 $SUBJECTBEG = ''; # Begin of subject group
517 $SUBJECTEND = ''; # End of subject group
518  
519 $TIDXLABEL = ''; # Label for thread index
520 $THEAD = ''; # Thread index header (and list start)
521 $TFOOT = ''; # Thread index footer (and list end)
522 $TSINGLETXT = ''; # Single/lone thread entry template
523 $TTOPBEG = ''; # Top of a thread begin template
524 $TTOPEND = ''; # Top of a thread end template
525 $TSUBLISTBEG = ''; # Sub-thread list open
526 $TSUBLISTEND = ''; # Sub-thread list close
527 $TLITXT = ''; # Thread list item text
528 $TLIEND = ''; # Thread list item end
529 $TLINONE = ''; # List item for missing message in thread
530 $TLINONEEND = ''; # List item end for missing message in thread
531 $TSUBJECTBEG = ''; # Pre-text for subject-based items
532 $TSUBJECTEND = ''; # Post-text for subject-based items
533 $TINDENTBEG = ''; # Thread indent open
534 $TINDENTEND = ''; # Thread indent close
535 $TCONTBEG = ''; # Thread continue open
536 $TCONTEND = ''; # Thread continue close
537  
538 $TSLICEBEG = ''; # Start of thread slice
539 $TSLICEEND = ''; # End of thread slice
540 $TSLICESINGLETXT = ''; # Single/lone thread entry template
541 $TSLICETOPBEG = ''; # Top of a thread begin template
542 $TSLICETOPEND = ''; # Top of a thread end template
543 $TSLICESUBLISTBEG = ''; # Sub-thread list open
544 $TSLICESUBLISTEND = ''; # Sub-thread list close
545 $TSLICELITXT = ''; # Thread list item text
546 $TSLICELIEND = ''; # Thread list item end
547 $TSLICELINONE = ''; # List item for missing message in thread
548 $TSLICELINONEEND = ''; # List item end for missing message in thread
549 $TSLICESUBJECTBEG = ''; # Pre-text for subject-based items
550 $TSLICESUBJECTEND = ''; # Post-text for subject-based items
551 $TSLICEINDENTBEG = ''; # Thread indent open
552 $TSLICEINDENTEND = ''; # Thread indent close
553 $TSLICECONTBEG = ''; # Thread continue open
554 $TSLICECONTEND = ''; # Thread continue close
555  
556 $TSLICESINGLETXTCUR = ''; # Current Single/lone thread entry template
557 $TSLICETOPBEGCUR = ''; # Current Top of a thread begin template
558 $TSLICETOPENDCUR = ''; # Current Top of a thread end template
559 $TSLICELITXTCUR = ''; # Thread list current item text
560 $TSLICELIENDCUR = ''; # Thread list current item end
561  
562 $MSGFOOT = ''; # Message footer
563 $MSGHEAD = ''; # Message header
564 $TOPLINKS = ''; # Message links at top of message
565 $BOTLINKS = ''; # Message links at bottom of message
566 $SUBJECTHEADER = ''; # Markup for message main subject line
567 $HEADBODYSEP = ''; # Markup between mail header and body
568 $MSGBODYEND = ''; # Markup at end of message data
569  
570 $FIELDSBEG = ''; # Beginning markup for mail header
571 $FIELDSEND = ''; # End markup for mail header
572 $FLDBEG = ''; # Beginning markup for field text
573 $FLDEND = ''; # End markup for field text
574 $LABELBEG = ''; # Beginning markup for field label
575 $LABELEND = ''; # End markup for field label
576  
577 $NEXTBUTTON = ''; # Next button template
578 $NEXTBUTTONIA = ''; # Next inactive button template
579 $PREVBUTTON = ''; # Previous button template
580 $PREVBUTTONIA = ''; # Previous inactive button template
581 $NEXTLINK = ''; # Next link template
582 $NEXTLINKIA = ''; # Next inactive link template
583 $PREVLINK = ''; # Previous link template
584 $PREVLINKIA = ''; # Previous inactive link template
585  
586 $TNEXTBUTTON = ''; # Thread Next button template
587 $TNEXTBUTTONIA = ''; # Thread Next inactive button template
588 $TPREVBUTTON = ''; # Thread Previous button template
589 $TPREVBUTTONIA = ''; # Thread Previous inactive button template
590  
591 $TTOPBUTTON = ''; # Top of thread button template
592 $TTOPBUTTONIA = ''; # Top of thread inactive button template
593 $TENDBUTTON = ''; # End of thread button template
594 $TENDBUTTONIA = ''; # End of thread inactive button template
595  
596 $TNEXTTOPBUTTON = ''; # Next Thread button template
597 $TNEXTTOPBUTTONIA = ''; # Next Thread inactive button template
598 $TPREVTOPBUTTON = ''; # Previous Thread button template
599 $TPREVTOPBUTTONIA = ''; # Previous Thread inactive button template
600  
601 $TNEXTINBUTTON = ''; # Within Thread Next button template
602 $TNEXTINBUTTONIA = ''; # Within Thread Next inactive button template
603 $TPREVINBUTTON = ''; # Within Thread Previous button template
604 $TPREVINBUTTONIA = ''; # Within Thread Previous inactive button template
605  
606 $TNEXTLINK = ''; # Thread Next link template
607 $TNEXTLINKIA = ''; # Thread Next inactive link template
608 $TPREVLINK = ''; # Thread Previous link template
609 $TPREVLINKIA = ''; # Thread Previous inactive link template
610  
611 $TTOPLINK = ''; # Top of thread link template
612 $TTOPLINKIA = ''; # Top of thread inactive link template
613 $TENDLINK = ''; # End of thread link template
614 $TENDLINKIA = ''; # End of thread inactive link template
615  
616 $TNEXTTOPLINK = ''; # Next Thread link template
617 $TNEXTTOPLINKIA = ''; # Next Thread inactive link template
618 $TPREVTOPLINK = ''; # Previous Thread link template
619 $TPREVTOPLINKIA = ''; # Previous Thread inactive link template
620  
621 $TNEXTINLINK = ''; # Within Thread Next link template
622 $TNEXTINLINKIA = ''; # Within Thread Next inactive link template
623 $TPREVINLINK = ''; # Within Thread Previous link template
624 $TPREVINLINKIA = ''; # Within Thread Previous inactive link template
625  
626 $IDXPGBEG = ''; # Beginning of main index page
627 $IDXPGEND = ''; # Ending of main index page
628 $TIDXPGBEG = ''; # Beginning of thread index page
629 $TIDXPGEND = ''; # Ending of thread index page
630  
631 $MSGPGBEG = ''; # Beginning of message page
632 $MSGPGEND = ''; # Ending of message page
633  
634 $FIRSTPGLINK = ''; # First page link template
635 $LASTPGLINK = ''; # Last page link template
636 $NEXTPGLINK = ''; # Next page link template
637 $NEXTPGLINKIA = ''; # Next page inactive link template
638 $PREVPGLINK = ''; # Previous page link template
639 $PREVPGLINKIA = ''; # Previous page inactive link template
640  
641 $TFIRSTPGLINK = ''; # First thread page link template
642 $TLASTPGLINK = ''; # Last thread page link template
643 $TNEXTPGLINK = ''; # Thread next page link template
644 $TNEXTPGLINKIA = ''; # Thread next page inactive link template
645 $TPREVPGLINK = ''; # Thread previous page link template
646 $TPREVPGLINKIA = ''; # Thread previous page inactive link template
647  
648 $FOLUPBEGIN = ''; # Start of follow-ups for message page
649 $FOLUPLITXT = ''; # Markup for follow-up list entry
650 $FOLUPEND = ''; # End of follow-ups for message page
651 $REFSBEGIN = ''; # Start of refs for message page
652 $REFSLITXT = ''; # Markup for ref list entry
653 $REFSEND = ''; # End of refs for message page
654  
655 $MSGIDLINK = ''; # Markup for linking message-ids
656  
657 $NOTE = ''; # Markup template when annotation available
658 $NOTEIA = ''; # Markup template when annotation not available
659 $NOTEICON = ''; # Markup template for note icon if annotation
660 $NOTEICONIA = ''; # Markup template for note icon if no annotation
661  
662 ## The following associative array if for defining custom
663 ## resource variables
664 %CustomRcVars = ();
665  
666 $X = "\034"; # Value separator (should equal $;)
667 # NOTE: Older versions used this variable as
668 # the list value separator. Its use should
669 # now only be for extracting time from
670 # indexes of messages or for processing
671 # old version data.
672  
673 }
674  
675 ##---------------------------------------------------------------------------##
676  
677 1;