| 1 | ##---------------------------------------------------------------------------## |
| 2 | ## File: |
| 3 | ## $Id: mhrcfile.pl,v 2.25 2002/07/27 05:13:13 ehood Exp $ |
| 4 | ## Author: |
| 5 | ## Earl Hood mhonarc@mhonarc.org |
| 6 | ## Description: |
| 7 | ## Routines for parsing resource files |
| 8 | ##---------------------------------------------------------------------------## |
| 9 | ## MHonArc -- Internet mail-to-HTML converter |
| 10 | ## Copyright (C) 1996-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 | ## read_resource_file() parses the resource file. |
| 32 | ## (The code for this routine could probably be simplified). |
| 33 | ## |
| 34 | sub read_resource_file { |
| 35 | my($file) = shift; |
| 36 | my($line, $tag, $label, $acro, $hr, $type, $routine, $plfile, |
| 37 | $url, $arg, $tmp, @a); |
| 38 | my($elem, $attr, $override, $handle, $pathhead, $chop); |
| 39 | local($_); |
| 40 | $override = 0; |
| 41 | |
| 42 | $handle = &file_open($file); |
| 43 | |
| 44 | if ($file =~ m%(.*[$DIRSEPREX])%o) { |
| 45 | $pathhead = $1; |
| 46 | $MainRcDir = $pathhead unless defined $MainRcDir; |
| 47 | } else { |
| 48 | $pathhead = ''; |
| 49 | } |
| 50 | |
| 51 | print STDOUT "Reading resource file: $file ...\n" unless $QUIET; |
| 52 | while (defined($line = <$handle>)) { |
| 53 | next unless $line =~ /^\s*<([^>]+)>/; |
| 54 | $attr = ''; |
| 55 | ($elem, $attr) = split(' ', $1, 2); |
| 56 | $attr = '' unless defined($attr); |
| 57 | $elem =~ tr/A-Z/a-z/; |
| 58 | $override = ($attr =~ /override/i); |
| 59 | $chop = ($attr =~ /chop/i); |
| 60 | |
| 61 | FMTSW: { |
| 62 | if ($elem eq 'addressmodifycode') { # Code to strip subjects |
| 63 | $AddressModify = &get_elem_content($handle, $elem, $chop); |
| 64 | last FMTSW; |
| 65 | } |
| 66 | if ($elem eq 'authorbegin') { # Begin for author group |
| 67 | $AUTHBEG = &get_elem_content($handle, $elem, $chop); |
| 68 | last FMTSW; |
| 69 | } |
| 70 | if ($elem eq 'authorend') { # End for author group |
| 71 | $AUTHEND = &get_elem_content($handle, $elem, $chop); |
| 72 | last FMTSW; |
| 73 | } |
| 74 | if ($elem eq 'authsort') { # Sort msgs by author |
| 75 | $AUTHSORT = 1; |
| 76 | $NOSORT = 0; $SUBSORT = 0; |
| 77 | last FMTSW; |
| 78 | } |
| 79 | if ($elem eq 'botlinks') { # Bottom links in message |
| 80 | $BOTLINKS = &get_elem_content($handle, $elem, $chop); |
| 81 | last FMTSW; |
| 82 | } |
| 83 | if ($elem eq 'charsetconverters') { # Charset filters |
| 84 | $IsDefault{'CHARSETCONVERTERS'} = 0; |
| 85 | if ($override) { |
| 86 | %readmail::MIMECharSetConverters = (); |
| 87 | %readmail::MIMECharSetConvertersSrc = (); |
| 88 | } |
| 89 | while (defined($line = <$handle>)) { |
| 90 | last if $line =~ /^\s*<\/charsetconverters\s*>/i; |
| 91 | next if $line =~ /^\s*$/; |
| 92 | $line =~ s/\s//g; |
| 93 | if ($line =~ /;/) { # using Perl 5 qualification |
| 94 | ($type,$routine,$plfile) = split(/;/,$line,3); |
| 95 | } else { |
| 96 | ($type,$routine,$plfile) = split(/:/,$line,3); |
| 97 | } |
| 98 | $type =~ tr/A-Z/a-z/; |
| 99 | $readmail::MIMECharSetConverters{$type} = $routine; |
| 100 | $readmail::MIMECharSetConvertersSrc{$type} = $plfile |
| 101 | if defined($plfile) and $plfile =~ /\S/; |
| 102 | } |
| 103 | last FMTSW; |
| 104 | } |
| 105 | if ($elem eq 'checknoarchive') { |
| 106 | $CheckNoArchive = 1; last FMTSW; |
| 107 | } |
| 108 | if ($elem eq 'conlen') { |
| 109 | $CONLEN = 1; last FMTSW; |
| 110 | } |
| 111 | if ($elem eq 'datefields') { |
| 112 | @a = &get_list_content($handle, $elem); |
| 113 | if (@a) { @DateFields = @a; } |
| 114 | last FMTSW; |
| 115 | } |
| 116 | if ($elem eq 'daybegin') { # Begin for day group |
| 117 | $DAYBEG = &get_elem_content($handle, $elem, $chop); |
| 118 | last FMTSW; |
| 119 | } |
| 120 | if ($elem eq 'dayend') { # End for day group |
| 121 | $DAYEND = &get_elem_content($handle, $elem, $chop); |
| 122 | last FMTSW; |
| 123 | } |
| 124 | if ($elem eq 'decodeheads') { |
| 125 | $DecodeHeads = 1; last FMTSW; |
| 126 | } |
| 127 | if ($elem eq 'definederived') { # Custom derived file |
| 128 | %UDerivedFile = () if $override; |
| 129 | $line = <$handle>; |
| 130 | last FMTSW if $line =~ /^\s*<\/definederived\s*>/i; |
| 131 | $line =~ s/\s//g; |
| 132 | $UDerivedFile{$line} = &get_elem_content($handle, $elem, $chop); |
| 133 | last FMTSW; |
| 134 | } |
| 135 | if ($elem eq 'definevar') { # Custom resource variable |
| 136 | @CustomRcVars = () if $override; |
| 137 | $line = <$handle>; |
| 138 | last FMTSW if $line =~ /^\s*<\/definevar\s*>/i; |
| 139 | $line =~ s/\s//g; |
| 140 | $CustomRcVars{$line} = &get_elem_content($handle, $elem, $chop); |
| 141 | last FMTSW; |
| 142 | } |
| 143 | if ($elem eq 'doc') { # Link to documentation |
| 144 | $NODOC = 0; last FMTSW; |
| 145 | } |
| 146 | if ($elem eq 'docurl') { # Doc URL |
| 147 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 148 | $DOCURL = $line; |
| 149 | } |
| 150 | last FMTSW; |
| 151 | } |
| 152 | if ($elem eq 'excs') { # Exclude header fields |
| 153 | %HFieldsExc = () if $override; |
| 154 | while (defined($line = <$handle>)) { |
| 155 | last if $line =~ /^\s*<\/excs\s*>/i; |
| 156 | $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; |
| 157 | $HFieldsExc{$line} = 1 if $line; |
| 158 | } |
| 159 | last FMTSW; |
| 160 | } |
| 161 | if ($elem eq 'expireage') { # Time in seconds until expire |
| 162 | if (($tmp = &get_elem_int($handle, $elem, 1)) ne '') { |
| 163 | $ExpireTime = $tmp; |
| 164 | } |
| 165 | last FMTSW; |
| 166 | } |
| 167 | if ($elem eq 'expiredate') { # Expiration date |
| 168 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 169 | $ExpireDate = $line; |
| 170 | } |
| 171 | last FMTSW; |
| 172 | } |
| 173 | if ($elem eq 'fieldstyles') { # Field text style |
| 174 | while (defined($line = <$handle>)) { |
| 175 | last if $line =~ /^\s*<\/fieldstyles\s*>/i; |
| 176 | next if $line =~ /^\s*$/; |
| 177 | $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; |
| 178 | ($label, $tag) = split(/:/,$line); |
| 179 | $HeadFields{$label} = $tag; |
| 180 | } |
| 181 | last FMTSW; |
| 182 | } |
| 183 | if ($elem eq 'fieldorder') { # Field order |
| 184 | @FieldOrder = (); %FieldODefs = (); |
| 185 | while (defined($line = <$handle>)) { |
| 186 | last if $line =~ /^\s*<\/fieldorder\s*>/i; |
| 187 | next if $line =~ /^\s*$/; |
| 188 | $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; |
| 189 | push(@FieldOrder, $line); |
| 190 | $FieldODefs{$line} = 1; |
| 191 | } |
| 192 | # push(@FieldOrder,'-extra-') if (!$FieldODefs{'-extra-'}); |
| 193 | last FMTSW; |
| 194 | } |
| 195 | if ($elem eq 'fieldsbeg') { # Begin markup of mail head |
| 196 | $FIELDSBEG = &get_elem_content($handle, $elem, $chop); |
| 197 | last FMTSW; |
| 198 | } |
| 199 | if ($elem eq 'fieldsend') { # End markup of mail head |
| 200 | $FIELDSEND = &get_elem_content($handle, $elem, $chop); |
| 201 | last FMTSW; |
| 202 | } |
| 203 | if ($elem eq 'firstpglink') { # First page link in index |
| 204 | $FIRSTPGLINK = &get_elem_content($handle, $elem, $chop); |
| 205 | last FMTSW; |
| 206 | } |
| 207 | if ($elem eq 'fldbeg') { # Begin markup of field text |
| 208 | $FLDBEG = &get_elem_content($handle, $elem, $chop); |
| 209 | last FMTSW; |
| 210 | } |
| 211 | if ($elem eq 'fldend') { # End markup of field text |
| 212 | $FLDEND = &get_elem_content($handle, $elem, $chop); |
| 213 | last FMTSW; |
| 214 | } |
| 215 | if ($elem eq 'folrefs') { # Print explicit fol/refs |
| 216 | $DoFolRefs = 1; last FMTSW; |
| 217 | } |
| 218 | if ($elem eq 'folupbegin') { # Begin markup for follow-ups |
| 219 | $FOLUPBEGIN = &get_elem_content($handle, $elem, $chop); |
| 220 | last FMTSW; |
| 221 | } |
| 222 | if ($elem eq 'folupend') { # End markup for follow-ups |
| 223 | $FOLUPEND = &get_elem_content($handle, $elem, $chop); |
| 224 | last FMTSW; |
| 225 | } |
| 226 | if ($elem eq 'foluplitxt') { # Follow-up link markup |
| 227 | $FOLUPLITXT = &get_elem_content($handle, $elem, $chop); |
| 228 | last FMTSW; |
| 229 | } |
| 230 | if ($elem eq 'fromfields') { # Fields to get author |
| 231 | @a = &get_list_content($handle, $elem); |
| 232 | if (@a) { @FromFields = @a; } |
| 233 | last FMTSW; |
| 234 | } |
| 235 | if ($elem eq 'gmtdatefmt') { # GMT date format |
| 236 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 237 | $GMTDateFmt = $line; |
| 238 | } |
| 239 | last FMTSW; |
| 240 | } |
| 241 | if ($elem eq 'gzipexe') { # Gzip executable |
| 242 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 243 | $line =~ s/\s+$//g; |
| 244 | $GzipExe = $line; |
| 245 | } |
| 246 | last FMTSW; |
| 247 | } |
| 248 | if ($elem eq 'gzipfiles') { |
| 249 | $GzipFiles = 1; last FMTSW; |
| 250 | } |
| 251 | if ($elem eq 'gziplinks') { |
| 252 | $GzipLinks = 1; last FMTSW; |
| 253 | } |
| 254 | if ($elem eq 'headbodysep') { |
| 255 | $HEADBODYSEP = &get_elem_content($handle, $elem, $chop); |
| 256 | last FMTSW; |
| 257 | } |
| 258 | if ($elem eq 'htmlext') { # Extension for HTML files |
| 259 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 260 | $line =~ s/\s//g; |
| 261 | $HtmlExt = $line; |
| 262 | } |
| 263 | last FMTSW; |
| 264 | } |
| 265 | if ($elem eq 'icons') { # Icons |
| 266 | %Icons = () if $override; |
| 267 | while (defined($line = <$handle>)) { |
| 268 | last if $line =~ /^\s*<\/icons\s*>/i; |
| 269 | next if $line =~ /^\s*$/; |
| 270 | $line =~ s/\s//g; |
| 271 | ($type, $url) = split(/[;:]/,$line,2); |
| 272 | $type =~ tr/A-Z/a-z/; |
| 273 | $Icons{$type} = $url; |
| 274 | } |
| 275 | last FMTSW; |
| 276 | } |
| 277 | if ($elem eq 'idxfname') { # Index filename |
| 278 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 279 | $line =~ s/\s//g; |
| 280 | $IDXNAME = $line; |
| 281 | } |
| 282 | last FMTSW; |
| 283 | } |
| 284 | if ($elem eq 'idxlabel') { # Index label |
| 285 | $IDXLABEL = &get_elem_content($handle, $elem, $chop); |
| 286 | last FMTSW; |
| 287 | } |
| 288 | if ($elem eq 'idxpgbegin') { # Opening markup of index |
| 289 | $IDXPGBEG = &get_elem_content($handle, $elem, $chop); |
| 290 | last FMTSW; |
| 291 | } |
| 292 | if ($elem eq 'idxpgend') { # Closing markup of index |
| 293 | $IDXPGEND = &get_elem_content($handle, $elem, $chop); |
| 294 | last FMTSW; |
| 295 | } |
| 296 | if ($elem eq 'idxprefix') { # Prefix for main idx pages |
| 297 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 298 | $line =~ s/\s//g; |
| 299 | $IDXPREFIX = $line; |
| 300 | } |
| 301 | last FMTSW; |
| 302 | } |
| 303 | if ($elem eq 'idxsize') { # Size of index |
| 304 | if (($tmp = &get_elem_int($handle, $elem, 1)) ne '') { |
| 305 | $IDXSIZE = $tmp; |
| 306 | } |
| 307 | last FMTSW; |
| 308 | } |
| 309 | if ($elem eq 'include') { # Include other rc files |
| 310 | while (defined($line = <$handle>)) { |
| 311 | last if $line =~ /^\s*<\/include\s*>/i; |
| 312 | next if $line =~ /^\s*$/; |
| 313 | $line =~ s/\s+$//; |
| 314 | $line = $pathhead . $line if ($line !~ /$DIRSEPREX/o); |
| 315 | &read_resource_file($line); |
| 316 | } |
| 317 | last FMTSW; |
| 318 | } |
| 319 | if ($elem eq 'keeponrmm') { # Keep files on rmm |
| 320 | $KeepOnRmm = 1; |
| 321 | last FMTSW; |
| 322 | } |
| 323 | if ($elem eq 'labelbeg') { # Begin markup of label |
| 324 | $LABELBEG = &get_elem_content($handle, $elem, $chop); |
| 325 | last FMTSW; |
| 326 | } |
| 327 | if ($elem eq 'labelend') { # End markup of label |
| 328 | $LABELEND = &get_elem_content($handle, $elem, $chop); |
| 329 | last FMTSW; |
| 330 | } |
| 331 | if ($elem eq 'labelstyles') { # Field label style |
| 332 | while (defined($line = <$handle>)) { |
| 333 | last if $line =~ /^\s*<\/labelstyles\s*>/i; |
| 334 | next if $line =~ /^\s*$/; |
| 335 | $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; |
| 336 | ($label, $tag) = split(/:/,$line); |
| 337 | $HeadHeads{$label} = $tag; |
| 338 | } |
| 339 | last FMTSW; |
| 340 | } |
| 341 | if ($elem eq 'lastpglink') { # Last page link in index |
| 342 | $LASTPGLINK = &get_elem_content($handle, $elem, $chop); |
| 343 | last FMTSW; |
| 344 | } |
| 345 | if ($elem eq 'listbegin') { # List begin |
| 346 | $LIBEG = &get_elem_content($handle, $elem, $chop); |
| 347 | last FMTSW; |
| 348 | } |
| 349 | if ($elem eq 'listend') { # List end |
| 350 | $LIEND = &get_elem_content($handle, $elem, $chop); |
| 351 | last FMTSW; |
| 352 | } |
| 353 | if ($elem eq 'litemplate') { # List item template |
| 354 | $LITMPL = &get_elem_content($handle, $elem, $chop); |
| 355 | last FMTSW; |
| 356 | } |
| 357 | if ($elem eq 'localdatefmt') { # Local date format |
| 358 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 359 | $LocalDateFmt = $line; |
| 360 | } |
| 361 | last FMTSW; |
| 362 | } |
| 363 | if ($elem eq 'lockmethod') { # Locking method |
| 364 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 365 | $LockMethod = &set_lock_mode($line); |
| 366 | } |
| 367 | last FMTSW; |
| 368 | } |
| 369 | if ($elem eq 'mailto') { # Convert e-mail addrs |
| 370 | $NOMAILTO = 0; last FMTSW; |
| 371 | } |
| 372 | if ($elem eq 'mailtourl') { # mailto URL |
| 373 | while (defined($line = <$handle>)) { |
| 374 | last if $line =~ /^\s*<\/mailtourl\s*>/i; |
| 375 | next if $line =~ /^\s*$/; |
| 376 | $line =~ s/\s//g; |
| 377 | $MAILTOURL = $line; |
| 378 | } |
| 379 | last FMTSW; |
| 380 | } |
| 381 | if ($elem eq 'main') { # Print main index |
| 382 | $MAIN = 1; last FMTSW; |
| 383 | } |
| 384 | if ($elem eq 'maxsize') { # Size of archive |
| 385 | if (($tmp = &get_elem_int($handle, $elem, 1)) ne '') { |
| 386 | $MAXSIZE = $tmp; |
| 387 | } |
| 388 | last FMTSW; |
| 389 | } |
| 390 | if ($elem eq 'msgbodyend') { # Markup after message body |
| 391 | $MSGBODYEND = &get_elem_content($handle, $elem, $chop); |
| 392 | last FMTSW; |
| 393 | } |
| 394 | if ($elem eq 'msgexcfilter') { # Code selectively exclude msgs |
| 395 | $MsgExcFilter = &get_elem_content($handle, $elem, $chop); |
| 396 | last FMTSW; |
| 397 | } |
| 398 | if ($elem eq 'msgpgs') { # Output message pages |
| 399 | $NoMsgPgs = 0; last FMTSW; |
| 400 | } |
| 401 | if ($elem eq 'msgprefix') { # Prefix for message files |
| 402 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 403 | $line =~ s/\s//g; |
| 404 | $MsgPrefix = $line; |
| 405 | } |
| 406 | last FMTSW; |
| 407 | } |
| 408 | if ($elem eq 'mhpattern') { # File pattern MH-like dirs |
| 409 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 410 | $MHPATTERN = $line; |
| 411 | } |
| 412 | last FMTSW; |
| 413 | } |
| 414 | if ($elem eq 'mimealtprefs') { # Mime alternative prefs |
| 415 | $IsDefault{'MIMEALTPREFS'} = 0; |
| 416 | @MIMEAltPrefs = (); |
| 417 | while (defined($line = <$handle>)) { |
| 418 | last if $line =~ /^\s*<\/mimealtprefs\s*>/i; |
| 419 | $line =~ s/\s//g; |
| 420 | push(@MIMEAltPrefs, lc($line)) if $line; |
| 421 | } |
| 422 | last FMTSW; |
| 423 | } |
| 424 | if ($elem eq 'mimedecoders') { # Mime decoders |
| 425 | $IsDefault{'MIMEDECODERS'} = 0; |
| 426 | if ($override) { |
| 427 | %readmail::MIMEDecoders = (); |
| 428 | %readmail::MIMEDecodersSrc = (); |
| 429 | } |
| 430 | while (defined($line = <$handle>)) { |
| 431 | last if $line =~ /^\s*<\/mimedecoders\s*>/i; |
| 432 | next unless $line =~ /\S/; |
| 433 | $line =~ s/\s//g; |
| 434 | if ($line =~ /;/) { # using Perl 5 qualification |
| 435 | ($type,$routine,$plfile) = split(/;/,$line,3); |
| 436 | } else { |
| 437 | ($type,$routine,$plfile) = split(/:/,$line,3); |
| 438 | } |
| 439 | $type =~ tr/A-Z/a-z/; |
| 440 | $readmail::MIMEDecoders{$type} = $routine; |
| 441 | $readmail::MIMEDecodersSrc{$type} = $plfile if $plfile =~ /\S/; |
| 442 | } |
| 443 | last FMTSW; |
| 444 | } |
| 445 | if ($elem eq 'mimefilters') { # Mime filters |
| 446 | $IsDefault{'MIMEFILTERS'} = 0; |
| 447 | if ($override) { |
| 448 | %readmail::MIMEFilters = (); |
| 449 | %readmail::MIMEFiltersSrc = (); |
| 450 | } |
| 451 | while (defined($line = <$handle>)) { |
| 452 | last if $line =~ /^\s*<\/mimefilters\s*>/i; |
| 453 | next if $line =~ /^\s*$/; |
| 454 | $line =~ s/\s//g; |
| 455 | if ($line =~ /;/) { # using Perl 5 qualification |
| 456 | ($type,$routine,$plfile) = split(/;/,$line,3); |
| 457 | } else { |
| 458 | ($type,$routine,$plfile) = split(/:/,$line,3); |
| 459 | } |
| 460 | $type =~ tr/A-Z/a-z/; |
| 461 | $readmail::MIMEFilters{$type} = $routine; |
| 462 | $readmail::MIMEFiltersSrc{$type} = $plfile if $plfile =~ /\S/; |
| 463 | } |
| 464 | last FMTSW; |
| 465 | } |
| 466 | if ($elem eq 'mimeargs') { # Mime arguments |
| 467 | $IsDefault{'MIMEARGS'} = 0; |
| 468 | %readmail::MIMEFiltersArgs = () if $override; |
| 469 | while (defined($line = <$handle>)) { |
| 470 | last if $line =~ /^\s*<\/mimeargs\s*>/i; |
| 471 | next unless $line =~ /\S/; |
| 472 | $line =~ s/^\s+//; |
| 473 | if ($line =~ /;/) { # using Perl 5 qualification |
| 474 | ($type, $arg) = split(/;/,$line,2); |
| 475 | } else { |
| 476 | ($type, $arg) = split(/:/,$line,2); |
| 477 | } |
| 478 | $type =~ tr/A-Z/a-z/ if $type =~ m%/%; |
| 479 | $readmail::MIMEFiltersArgs{$type} = $arg; |
| 480 | } |
| 481 | last FMTSW; |
| 482 | } |
| 483 | if ($elem eq 'mimeexcs') { # Mime exclusions |
| 484 | $IsDefault{'MIMEEXCS'} = 0; |
| 485 | %readmail::MIMEExcs = () if $override; |
| 486 | while (defined($line = <$handle>)) { |
| 487 | last if $line =~ /^\s*<\/mimeexcs\s*>/i; |
| 488 | $line =~ s/\s//g; $line =~ tr/A-Z/a-z/; |
| 489 | $readmail::MIMEExcs{$line} = 1 if $line; |
| 490 | } |
| 491 | last FMTSW; |
| 492 | } |
| 493 | if ($elem eq 'months') { # Full month names |
| 494 | @a = &get_list_content($handle, $elem); |
| 495 | if (scalar(@a)) { |
| 496 | @Months = @a; |
| 497 | } |
| 498 | last FMTSW; |
| 499 | } |
| 500 | if ($elem eq 'monthsabr') { # Abbreviated month names |
| 501 | @a = &get_list_content($handle, $elem); |
| 502 | if (scalar(@a)) { |
| 503 | @months = @a; |
| 504 | } |
| 505 | last FMTSW; |
| 506 | } |
| 507 | if ($elem eq 'modtime') { # Mod time same as msg date |
| 508 | $MODTIME = 1; last FMTSW; |
| 509 | } |
| 510 | if ($elem eq 'msgfoot') { # Message footer text |
| 511 | $MSGFOOT = &get_elem_content($handle, $elem, $chop); |
| 512 | last FMTSW; |
| 513 | } |
| 514 | if ($elem eq 'msggmtdatefmt') { # Message GMT date format |
| 515 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 516 | $MsgGMTDateFmt = $line; |
| 517 | } |
| 518 | last FMTSW; |
| 519 | } |
| 520 | if ($elem eq 'msghead') { # Message header text |
| 521 | $MSGHEAD = &get_elem_content($handle, $elem, $chop); |
| 522 | last FMTSW; |
| 523 | } |
| 524 | if ($elem eq 'msgidlink') { |
| 525 | $MSGIDLINK = &get_elem_content($handle, $elem, $chop); |
| 526 | last FMTSW; |
| 527 | } |
| 528 | if ($elem eq 'msglocaldatefmt') { # Message local date format |
| 529 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 530 | $MsgLocalDateFmt = $line; |
| 531 | } |
| 532 | last FMTSW; |
| 533 | } |
| 534 | if ($elem eq 'msgpgbegin') { # Opening markup of message |
| 535 | $MSGPGBEG = &get_elem_content($handle, $elem, $chop); |
| 536 | last FMTSW; |
| 537 | } |
| 538 | if ($elem eq 'msgpgend') { # Closing markup of message |
| 539 | $MSGPGEND = &get_elem_content($handle, $elem, $chop); |
| 540 | last FMTSW; |
| 541 | } |
| 542 | if ($elem eq 'msgsep') { # Message separator |
| 543 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 544 | $FROM = $line; |
| 545 | } |
| 546 | last FMTSW; |
| 547 | } |
| 548 | if ($elem eq 'multipg') { # Print multi-page indexes |
| 549 | $MULTIIDX = 1; last FMTSW; |
| 550 | } |
| 551 | if ($elem eq 'nextbutton') { # Next button link in message |
| 552 | $NEXTBUTTON = &get_elem_content($handle, $elem, $chop); |
| 553 | last FMTSW; |
| 554 | } |
| 555 | if ($elem eq 'nextbuttonia') { |
| 556 | $NEXTBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 557 | last FMTSW; |
| 558 | } |
| 559 | if ($elem eq 'nextlink') { # Next link in message |
| 560 | $NEXTLINK = &get_elem_content($handle, $elem, $chop); |
| 561 | last FMTSW; |
| 562 | } |
| 563 | if ($elem eq 'nextlinkia') { |
| 564 | $NEXTLINKIA = &get_elem_content($handle, $elem, $chop); |
| 565 | last FMTSW; |
| 566 | } |
| 567 | if ($elem eq 'nextpglink') { # Next page link in index |
| 568 | $NEXTPGLINK = &get_elem_content($handle, $elem, $chop); |
| 569 | last FMTSW; |
| 570 | } |
| 571 | if ($elem eq 'nextpglinkia') { |
| 572 | $NEXTPGLINKIA = &get_elem_content($handle, $elem, $chop); |
| 573 | last FMTSW; |
| 574 | } |
| 575 | if ($elem eq 'news') { # News for linking |
| 576 | $NONEWS = 0; last FMTSW; |
| 577 | } |
| 578 | if ($elem eq 'noauthsort') { # Do not sort msgs by author |
| 579 | $AUTHSORT = 0; |
| 580 | last FMTSW; |
| 581 | } |
| 582 | if ($elem eq 'nochecknoarchive') { |
| 583 | $CheckNoArchive = 0; last FMTSW; |
| 584 | } |
| 585 | if ($elem eq 'noconlen') { # Ignore content-length |
| 586 | $CONLEN = 0; last FMTSW; |
| 587 | } |
| 588 | if ($elem eq 'nodecodeheads') { # Don't decode charsets |
| 589 | $DecodeHeads = 0; last FMTSW; |
| 590 | } |
| 591 | if ($elem eq 'nodoc') { # Do not link to docs |
| 592 | $NODOC = 1; last FMTSW; |
| 593 | } |
| 594 | if ($elem eq 'nofolrefs') { # Don't print explicit fol/refs |
| 595 | $DoFolRefs = 0; last FMTSW; |
| 596 | } |
| 597 | if ($elem eq 'nogzipfiles') { # Don't gzip files |
| 598 | $GzipFiles = 0; last FMTSW; |
| 599 | } |
| 600 | if ($elem eq 'nogziplinks') { # Don't add ".gz" to links |
| 601 | $GzipLinks = 0; last FMTSW; |
| 602 | } |
| 603 | if ($elem eq 'nokeeponrmm') { # Remove files on rmm |
| 604 | $KeepOnRmm = 0; |
| 605 | last FMTSW; |
| 606 | } |
| 607 | if ($elem eq 'nomailto') { # Do not convert e-mail addrs |
| 608 | $NOMAILTO = 1; last FMTSW; |
| 609 | } |
| 610 | if ($elem eq 'nomain') { # No main index |
| 611 | $MAIN = 0; last FMTSW; |
| 612 | } |
| 613 | if ($elem eq 'nomodtime') { # Do not change mod times |
| 614 | $MODTIME = 0; last FMTSW; |
| 615 | } |
| 616 | if ($elem eq 'nomsgpgs') { # Do not print message pages |
| 617 | $NoMsgPgs = 1; last FMTSW; |
| 618 | } |
| 619 | if ($elem eq 'nomultipg') { # Single page index |
| 620 | $MULTIIDX = 0; last FMTSW; |
| 621 | } |
| 622 | if ($elem eq 'nonews') { # Ignore news for linking |
| 623 | $NONEWS = 1; last FMTSW; |
| 624 | } |
| 625 | if ($elem eq 'noposixstrftime') { # Do not use POSIX::strftime() |
| 626 | $POSIXstrftime = 0; |
| 627 | last FMTSW; |
| 628 | } |
| 629 | if ($elem eq 'noreverse') { # Sort in normal order |
| 630 | $REVSORT = 0; last FMTSW; |
| 631 | } |
| 632 | if ($elem eq 'nosaveresources') { # Do not save resources |
| 633 | $SaveRsrcs = 0; |
| 634 | last FMTSW; |
| 635 | } |
| 636 | if ($elem eq 'nosort') { # Do not sort messages |
| 637 | $NOSORT = 1; |
| 638 | last FMTSW; |
| 639 | } |
| 640 | if ($elem eq 'nospammode') { # Do not do anti-spam stuff |
| 641 | $SpamMode = 0; last FMTSW; |
| 642 | } |
| 643 | if ($elem eq 'nosubjectthreads') { # No check subjects for threads |
| 644 | $NoSubjectThreads = 1; |
| 645 | last FMTSW; |
| 646 | } |
| 647 | if ($elem eq 'nosubjecttxt') { # Text to use if no subject |
| 648 | $NoSubjectTxt = &get_elem_content($handle, $elem, $chop); |
| 649 | last FMTSW; |
| 650 | } |
| 651 | if ($elem eq 'nosubsort') { # Do not sort msgs by subject |
| 652 | $SUBSORT = 0; |
| 653 | last FMTSW; |
| 654 | } |
| 655 | if ($elem eq 'note') { # Annotation markup |
| 656 | $NOTE = &get_elem_content($handle, $elem, $chop); |
| 657 | last FMTSW; |
| 658 | } |
| 659 | if ($elem eq 'notedir') { # Notes directory |
| 660 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 661 | $NoteDir = $line; |
| 662 | } |
| 663 | last FMTSW; |
| 664 | } |
| 665 | if ($elem eq 'noteia') { # No Annotation markup |
| 666 | $NOTEIA = &get_elem_content($handle, $elem, $chop); |
| 667 | last FMTSW; |
| 668 | } |
| 669 | if ($elem eq 'noteicon') { # Note icon |
| 670 | $NOTEICON = &get_elem_content($handle, $elem, $chop); |
| 671 | last FMTSW; |
| 672 | } |
| 673 | if ($elem eq 'noteiconia') { # Note icon when no annotation |
| 674 | $NOTEICONIA = &get_elem_content($handle, $elem, $chop); |
| 675 | last FMTSW; |
| 676 | } |
| 677 | if ($elem eq 'nothread') { # No thread index |
| 678 | $THREAD = 0; last FMTSW; |
| 679 | } |
| 680 | if ($elem eq 'notreverse') { # Thread sort in normal order |
| 681 | $TREVERSE = 0; last FMTSW; |
| 682 | } |
| 683 | if ($elem eq 'notsubsort' || |
| 684 | $elem eq 'tnosubsort') { # No subject order for threads |
| 685 | $TSUBSORT = 0; |
| 686 | last FMTSW; |
| 687 | } |
| 688 | if ($elem eq 'notsort' || |
| 689 | $elem eq 'tnosort') { # Raw order for threads |
| 690 | $TNOSORT = 1; $TSUBSORT = 0; |
| 691 | last FMTSW; |
| 692 | } |
| 693 | if ($elem eq 'nourl') { # Ignore URLs |
| 694 | $NOURL = 1; last FMTSW; |
| 695 | } |
| 696 | if ($elem eq 'nouselocaltime') { # Not using localtime |
| 697 | $UseLocalTime = 0; last FMTSW; |
| 698 | } |
| 699 | if ($elem eq 'nousinglastpg') { # Not using $LASTPG$ |
| 700 | $UsingLASTPG = 0; last FMTSW; |
| 701 | } |
| 702 | if ($elem eq 'otherindexes') { # Other indexes |
| 703 | @OtherIdxs = () if $override; |
| 704 | unshift(@OtherIdxs, &get_pathname_content($handle, $elem)); |
| 705 | last FMTSW; |
| 706 | } |
| 707 | if ($elem eq 'perlinc') { # Define perl search paths |
| 708 | @PerlINC = () if $override; |
| 709 | unshift(@PerlINC, &get_pathname_content($handle, $elem)); |
| 710 | last FMTSW; |
| 711 | } |
| 712 | if ($elem eq 'posixstrftime') { # Use POSIX::strftime() |
| 713 | $POSIXstrftime = 1; |
| 714 | last FMTSW; |
| 715 | } |
| 716 | if ($elem eq 'prevbutton') { # Prev button link in message |
| 717 | $PREVBUTTON = &get_elem_content($handle, $elem, $chop); |
| 718 | last FMTSW; |
| 719 | } |
| 720 | if ($elem eq 'prevbuttonia') { # Prev i/a button link |
| 721 | $PREVBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 722 | last FMTSW; |
| 723 | } |
| 724 | if ($elem eq 'prevlink') { # Prev link in message |
| 725 | $PREVLINK = &get_elem_content($handle, $elem, $chop); |
| 726 | last FMTSW; |
| 727 | } |
| 728 | if ($elem eq 'prevlinkia') { # Prev i/a link |
| 729 | $PREVLINKIA = &get_elem_content($handle, $elem, $chop); |
| 730 | last FMTSW; |
| 731 | } |
| 732 | if ($elem eq 'prevpglink') { # Prev page link for index |
| 733 | $PREVPGLINK = &get_elem_content($handle, $elem, $chop); |
| 734 | last FMTSW; |
| 735 | } |
| 736 | if ($elem eq 'prevpglinkia') { |
| 737 | $PREVPGLINKIA = &get_elem_content($handle, $elem, $chop); |
| 738 | last FMTSW; |
| 739 | } |
| 740 | if ($elem eq 'refsbegin') { # Explicit ref links begin |
| 741 | $REFSBEGIN = &get_elem_content($handle, $elem, $chop); |
| 742 | last FMTSW; |
| 743 | } |
| 744 | if ($elem eq 'refsend') { # Explicit ref links end |
| 745 | $REFSEND = &get_elem_content($handle, $elem, $chop); |
| 746 | last FMTSW; |
| 747 | } |
| 748 | if ($elem eq 'refslitxt') { # Explicit ref link |
| 749 | $REFSLITXT = &get_elem_content($handle, $elem, $chop); |
| 750 | last FMTSW; |
| 751 | } |
| 752 | if ($elem eq 'reverse') { # Reverse sort |
| 753 | $REVSORT = 1; |
| 754 | last FMTSW; |
| 755 | } |
| 756 | if ($elem eq 'saveresources') { # Save resources in db |
| 757 | $SaveRsrcs = 1; |
| 758 | last FMTSW; |
| 759 | } |
| 760 | if ($elem eq 'sort') { # Sort messages by date |
| 761 | $NOSORT = 0; |
| 762 | $AUTHSORT = 0; $SUBSORT = 0; |
| 763 | last FMTSW; |
| 764 | } |
| 765 | if ($elem eq 'spammode') { # Obfsucate/hide addresses |
| 766 | $SpamMode = 1; last FMTSW; |
| 767 | } |
| 768 | if ($elem eq 'ssmarkup') { # Initial page markup |
| 769 | $SSMARKUP = &get_elem_content($handle, $elem, $chop); |
| 770 | last FMTSW; |
| 771 | } |
| 772 | if ($elem eq 'msgpgssmarkup') { # Initial message page markup |
| 773 | $MSGPGSSMARKUP = &get_elem_content($handle, $elem, $chop); |
| 774 | last FMTSW; |
| 775 | } |
| 776 | if ($elem eq 'idxpgssmarkup') { # Initial index page markup |
| 777 | $IDXPGSSMARKUP = &get_elem_content($handle, $elem, $chop); |
| 778 | last FMTSW; |
| 779 | } |
| 780 | if ($elem eq 'tidxpgssmarkup') { # Initial thread idx page markup |
| 781 | $TIDXPGSSMARKUP = &get_elem_content($handle, $elem, $chop); |
| 782 | last FMTSW; |
| 783 | } |
| 784 | if ($elem eq 'subjectarticlerxp') { # Regex for language articles |
| 785 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 786 | $SubArtRxp = $line; |
| 787 | } |
| 788 | last FMTSW; |
| 789 | } |
| 790 | if ($elem eq 'subjectreplyrxp') { # Regex for reply text |
| 791 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 792 | $SubReplyRxp = $line; |
| 793 | } |
| 794 | last FMTSW; |
| 795 | } |
| 796 | if ($elem eq 'subjectstripcode') { # Code to strip subjects |
| 797 | $SubStripCode = &get_elem_content($handle, $elem, $chop); |
| 798 | last FMTSW; |
| 799 | } |
| 800 | if ($elem eq 'subjectthreads') { # Check subjects for threads |
| 801 | $NoSubjectThreads = 0; |
| 802 | last FMTSW; |
| 803 | } |
| 804 | if ($elem eq 'subsort') { # Sort messages by subject |
| 805 | $SUBSORT = 1; |
| 806 | $AUTHSORT = 0; $NOSORT = 0; |
| 807 | last FMTSW; |
| 808 | } |
| 809 | if ($elem eq 'subjectbegin') { # Begin for subject group |
| 810 | $SUBJECTBEG = &get_elem_content($handle, $elem, $chop); |
| 811 | last FMTSW; |
| 812 | } |
| 813 | if ($elem eq 'subjectend') { # End for subject group |
| 814 | $SUBJECTEND = &get_elem_content($handle, $elem, $chop); |
| 815 | last FMTSW; |
| 816 | } |
| 817 | if ($elem eq 'subjectheader') { |
| 818 | $SUBJECTHEADER = &get_elem_content($handle, $elem, $chop); |
| 819 | last FMTSW; |
| 820 | } |
| 821 | if ($elem eq 'tcontbegin') { # Thread cont. start |
| 822 | $TCONTBEG = &get_elem_content($handle, $elem, $chop); |
| 823 | last FMTSW; |
| 824 | } |
| 825 | if ($elem eq 'tcontend') { # Thread cont. end |
| 826 | $TCONTEND = &get_elem_content($handle, $elem, $chop); |
| 827 | last FMTSW; |
| 828 | } |
| 829 | if ($elem eq 'textclipfunc') { # Text clipping function |
| 830 | $TextClipFunc = undef; |
| 831 | $TextClipSrc = undef; |
| 832 | while (defined($line = <$handle>)) { |
| 833 | last if $line =~ /^\s*<\/textclipfunc\s*>/i; |
| 834 | next if $line =~ /^\s*$/; |
| 835 | $line =~ s/\s//g; |
| 836 | ($TextClipFunc,$TextClipSrc) = split(/;/,$line,2); |
| 837 | } |
| 838 | } |
| 839 | if ($elem eq 'tfirstpglink') { # First thread page link |
| 840 | $TFIRSTPGLINK = &get_elem_content($handle, $elem, $chop); |
| 841 | last FMTSW; |
| 842 | } |
| 843 | if ($elem eq 'tfoot') { # Thread idx foot |
| 844 | $TFOOT = &get_elem_content($handle, $elem, $chop); |
| 845 | last FMTSW; |
| 846 | } |
| 847 | if ($elem eq 'thead') { # Thread idx head |
| 848 | $THEAD = &get_elem_content($handle, $elem, $chop); |
| 849 | last FMTSW; |
| 850 | } |
| 851 | if ($elem eq 'tidxfname') { # Threaded idx filename |
| 852 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 853 | $line =~ s/\s//g; |
| 854 | $TIDXNAME = $line; |
| 855 | } |
| 856 | last FMTSW; |
| 857 | } |
| 858 | if ($elem eq 'tidxlabel') { # Thread index label |
| 859 | $TIDXLABEL = &get_elem_content($handle, $elem, $chop); |
| 860 | last FMTSW; |
| 861 | } |
| 862 | if ($elem eq 'tidxpgbegin') { # Opening markup of thread idx |
| 863 | $TIDXPGBEG = &get_elem_content($handle, $elem, $chop); |
| 864 | last FMTSW; |
| 865 | } |
| 866 | if ($elem eq 'tidxpgend') { # Closing markup of thread idx |
| 867 | $TIDXPGEND = &get_elem_content($handle, $elem, $chop); |
| 868 | last FMTSW; |
| 869 | } |
| 870 | if ($elem eq 'tidxprefix') { # Prefix for thread idx pages |
| 871 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 872 | $line =~ s/\s//g; |
| 873 | $TIDXPREFIX = $line; |
| 874 | } |
| 875 | last FMTSW; |
| 876 | } |
| 877 | if ($elem eq 'timezones') { # Time zones |
| 878 | if ($override) { %ZoneUD = (); } |
| 879 | while (defined($line = <$handle>)) { |
| 880 | last if $line =~ /^\s*<\/timezones\s*>/i; |
| 881 | $line =~ s/\s//g; $line =~ tr/a-z/A-Z/; |
| 882 | ($acro,$hr) = split(/:/,$line); |
| 883 | $acro =~ tr/a-z/A-Z/; |
| 884 | $ZoneUD{$acro} = $hr; |
| 885 | } |
| 886 | last FMTSW; |
| 887 | } |
| 888 | if ($elem eq 'tindentbegin') { # Thread indent start |
| 889 | $TINDENTBEG = &get_elem_content($handle, $elem, $chop); |
| 890 | last FMTSW; |
| 891 | } |
| 892 | if ($elem eq 'tindentend') { # Thread indent end |
| 893 | $TINDENTEND = &get_elem_content($handle, $elem, $chop); |
| 894 | last FMTSW; |
| 895 | } |
| 896 | if ($elem eq 'title') { # Title of index page |
| 897 | $TITLE = &get_elem_content($handle, $elem, $chop); |
| 898 | last FMTSW; |
| 899 | } |
| 900 | if ($elem eq 'tlastpglink') { # Last thread page link |
| 901 | $TLASTPGLINK = &get_elem_content($handle, $elem, $chop); |
| 902 | last FMTSW; |
| 903 | } |
| 904 | if ($elem eq 'tlevels') { # Level of threading |
| 905 | if (($tmp = &get_elem_int($handle, $elem, 1)) ne '') { |
| 906 | $TLEVELS = $tmp; |
| 907 | } |
| 908 | last FMTSW; |
| 909 | } |
| 910 | if ($elem eq 'tlinone') { # Markup for missing message |
| 911 | $TLINONE = &get_elem_content($handle, $elem, $chop); |
| 912 | last FMTSW; |
| 913 | } |
| 914 | if ($elem eq 'tlinoneend') { # End markup for missing msg |
| 915 | $TLINONEEND = &get_elem_content($handle, $elem, $chop); |
| 916 | last FMTSW; |
| 917 | } |
| 918 | if ($elem eq 'tlitxt') { # Thread idx list item |
| 919 | $TLITXT = &get_elem_content($handle, $elem, $chop); |
| 920 | last FMTSW; |
| 921 | } |
| 922 | if ($elem eq 'tliend') { # Thread idx list item end |
| 923 | $TLIEND = &get_elem_content($handle, $elem, $chop); |
| 924 | last FMTSW; |
| 925 | } |
| 926 | if ($elem eq 'toplinks') { # Top links in message |
| 927 | $TOPLINKS = &get_elem_content($handle, $elem, $chop); |
| 928 | last FMTSW; |
| 929 | } |
| 930 | if ($elem eq 'tslice') { |
| 931 | ($TSliceNBefore, $TSliceNAfter, $TSliceInclusive) = |
| 932 | &get_list_content($handle, $elem); |
| 933 | last FMTSW; |
| 934 | } |
| 935 | if ($elem eq 'tslicebeg') { # Start of thread slice |
| 936 | $TSLICEBEG = &get_elem_content($handle, $elem, $chop); |
| 937 | last FMTSW; |
| 938 | } |
| 939 | if ($elem eq 'tsliceend') { # End of thread slice |
| 940 | $TSLICEEND = &get_elem_content($handle, $elem, $chop); |
| 941 | last FMTSW; |
| 942 | } |
| 943 | if ($elem eq 'tslicelevels') { # Level of slice threading |
| 944 | if (($tmp = &get_elem_int($handle, $elem, 1)) ne '') { |
| 945 | $TSLICELEVELS = $tmp; |
| 946 | } |
| 947 | last FMTSW; |
| 948 | } |
| 949 | if ($elem eq 'tslicesingletxt') { |
| 950 | $TSLICESINGLETXT = &get_elem_content($handle, $elem, $chop); |
| 951 | last FMTSW; |
| 952 | } |
| 953 | if ($elem eq 'tslicetopbegin') { |
| 954 | $TSLICETOPBEG = &get_elem_content($handle, $elem, $chop); |
| 955 | last FMTSW; |
| 956 | } |
| 957 | if ($elem eq 'tslicetopend') { |
| 958 | $TSLICETOPEND = &get_elem_content($handle, $elem, $chop); |
| 959 | last FMTSW; |
| 960 | } |
| 961 | if ($elem eq 'tslicesublistbeg') { |
| 962 | $TSLICESUBLISTBEG = &get_elem_content($handle, $elem, $chop); |
| 963 | last FMTSW; |
| 964 | } |
| 965 | if ($elem eq 'tslicesublistend') { |
| 966 | $TSLICESUBLISTEND = &get_elem_content($handle, $elem, $chop); |
| 967 | last FMTSW; |
| 968 | } |
| 969 | if ($elem eq 'tslicelitxt') { |
| 970 | $TSLICELITXT = &get_elem_content($handle, $elem, $chop); |
| 971 | last FMTSW; |
| 972 | } |
| 973 | if ($elem eq 'tsliceliend') { |
| 974 | $TSLICELIEND = &get_elem_content($handle, $elem, $chop); |
| 975 | last FMTSW; |
| 976 | } |
| 977 | if ($elem eq 'tslicelinone') { |
| 978 | $TSLICELINONE = &get_elem_content($handle, $elem, $chop); |
| 979 | last FMTSW; |
| 980 | } |
| 981 | if ($elem eq 'tslicelinoneend') { |
| 982 | $TSLICELINONEEND = &get_elem_content($handle, $elem, $chop); |
| 983 | last FMTSW; |
| 984 | } |
| 985 | if ($elem eq 'tslicesubjectbeg') { |
| 986 | $TSLICESUBJECTBEG = &get_elem_content($handle, $elem, $chop); |
| 987 | last FMTSW; |
| 988 | } |
| 989 | if ($elem eq 'tslicesubjectend') { |
| 990 | $TSLICESUBJECTEND = &get_elem_content($handle, $elem, $chop); |
| 991 | last FMTSW; |
| 992 | } |
| 993 | if ($elem eq 'tsliceindentbegin') { |
| 994 | $TSLICEINDENTBEG = &get_elem_content($handle, $elem, $chop); |
| 995 | last FMTSW; |
| 996 | } |
| 997 | if ($elem eq 'tsliceindentend') { |
| 998 | $TSLICEINDENTEND = &get_elem_content($handle, $elem, $chop); |
| 999 | last FMTSW; |
| 1000 | } |
| 1001 | if ($elem eq 'tslicecontbegin') { |
| 1002 | $TSLICECONTBEG = &get_elem_content($handle, $elem, $chop); |
| 1003 | last FMTSW; |
| 1004 | } |
| 1005 | if ($elem eq 'tslicecontend') { |
| 1006 | $TSLICECONTEND = &get_elem_content($handle, $elem, $chop); |
| 1007 | last FMTSW; |
| 1008 | } |
| 1009 | if ($elem eq 'tslicesingletxtcur') { |
| 1010 | $TSLICESINGLETXTCUR = &get_elem_content($handle, $elem, $chop); |
| 1011 | last FMTSW; |
| 1012 | } |
| 1013 | if ($elem eq 'tslicetopbegincur') { |
| 1014 | $TSLICETOPBEGCUR = &get_elem_content($handle, $elem, $chop); |
| 1015 | last FMTSW; |
| 1016 | } |
| 1017 | if ($elem eq 'tslicetopendcur') { |
| 1018 | $TSLICETOPENDCUR = &get_elem_content($handle, $elem, $chop); |
| 1019 | last FMTSW; |
| 1020 | } |
| 1021 | if ($elem eq 'tslicelitxtcur') { |
| 1022 | $TSLICELITXTCUR = &get_elem_content($handle, $elem, $chop); |
| 1023 | last FMTSW; |
| 1024 | } |
| 1025 | if ($elem eq 'tsliceliendcur') { |
| 1026 | $TSLICELIENDCUR = &get_elem_content($handle, $elem, $chop); |
| 1027 | last FMTSW; |
| 1028 | } |
| 1029 | if ($elem eq 'tsort') { # Date order for threads |
| 1030 | $TNOSORT = 0; $TSUBSORT = 0; |
| 1031 | last FMTSW; |
| 1032 | } |
| 1033 | if ($elem eq 'tsubsort') { # Subject order for threads |
| 1034 | $TNOSORT = 0; $TSUBSORT = 1; |
| 1035 | last FMTSW; |
| 1036 | } |
| 1037 | if ($elem eq 'tsublistbeg') { # List begin in sub-thread |
| 1038 | $TSUBLISTBEG = &get_elem_content($handle, $elem, $chop); |
| 1039 | last FMTSW; |
| 1040 | } |
| 1041 | if ($elem eq 'tsublistend') { # List end in sub-thread |
| 1042 | $TSUBLISTEND = &get_elem_content($handle, $elem, $chop); |
| 1043 | last FMTSW; |
| 1044 | } |
| 1045 | if ($elem eq 'tsubjectbeg') { # Begin markup for sub thread |
| 1046 | $TSUBJECTBEG = &get_elem_content($handle, $elem, $chop); |
| 1047 | last FMTSW; |
| 1048 | } |
| 1049 | if ($elem eq 'tsubjectend') { # End markup for sub thread |
| 1050 | $TSUBJECTEND = &get_elem_content($handle, $elem, $chop); |
| 1051 | last FMTSW; |
| 1052 | } |
| 1053 | if ($elem eq 'tsingletxt') { # Markup for single msg |
| 1054 | $TSINGLETXT = &get_elem_content($handle, $elem, $chop); |
| 1055 | last FMTSW; |
| 1056 | } |
| 1057 | if ($elem eq 'ttopbegin') { # Begin for top of a thread |
| 1058 | $TTOPBEG = &get_elem_content($handle, $elem, $chop); |
| 1059 | last FMTSW; |
| 1060 | } |
| 1061 | if ($elem eq 'ttopend') { # End for a thread |
| 1062 | $TTOPEND = &get_elem_content($handle, $elem, $chop); |
| 1063 | last FMTSW; |
| 1064 | } |
| 1065 | if ($elem eq 'ttitle') { # Title of threaded idx |
| 1066 | $TTITLE = &get_elem_content($handle, $elem, $chop); |
| 1067 | last FMTSW; |
| 1068 | } |
| 1069 | if ($elem eq 'thread') { # Create thread index |
| 1070 | $THREAD = 1; last FMTSW; |
| 1071 | } |
| 1072 | if ($elem eq 'tnextbutton') { # Thread Next button link |
| 1073 | $TNEXTBUTTON = &get_elem_content($handle, $elem, $chop); |
| 1074 | last FMTSW; |
| 1075 | } |
| 1076 | if ($elem eq 'tnextbuttonia') { |
| 1077 | $TNEXTBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 1078 | last FMTSW; |
| 1079 | } |
| 1080 | if ($elem eq 'tnextinbutton') { # Within Thread Next button link |
| 1081 | $TNEXTINBUTTON = &get_elem_content($handle, $elem, $chop); |
| 1082 | last FMTSW; |
| 1083 | } |
| 1084 | if ($elem eq 'tnextinbuttonia') { |
| 1085 | $TNEXTINBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 1086 | last FMTSW; |
| 1087 | } |
| 1088 | if ($elem eq 'tnextinlink') { # Within Thread Next link |
| 1089 | $TNEXTINLINK = &get_elem_content($handle, $elem, $chop); |
| 1090 | last FMTSW; |
| 1091 | } |
| 1092 | if ($elem eq 'tnextinlinkia') { |
| 1093 | $TNEXTINLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1094 | last FMTSW; |
| 1095 | } |
| 1096 | if ($elem eq 'tnextlink') { # Thread Next link |
| 1097 | $TNEXTLINK = &get_elem_content($handle, $elem, $chop); |
| 1098 | last FMTSW; |
| 1099 | } |
| 1100 | if ($elem eq 'tnextlinkia') { |
| 1101 | $TNEXTLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1102 | last FMTSW; |
| 1103 | } |
| 1104 | if ($elem eq 'tnextpglink') { # Thread next page link |
| 1105 | $TNEXTPGLINK = &get_elem_content($handle, $elem, $chop); |
| 1106 | last FMTSW; |
| 1107 | } |
| 1108 | if ($elem eq 'tnextpglinkia') { |
| 1109 | $TNEXTPGLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1110 | last FMTSW; |
| 1111 | } |
| 1112 | if ($elem eq 'tprevbutton') { # Thread Prev button link |
| 1113 | $TPREVBUTTON = &get_elem_content($handle, $elem, $chop); |
| 1114 | last FMTSW; |
| 1115 | } |
| 1116 | if ($elem eq 'tprevbuttonia') { |
| 1117 | $TPREVBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 1118 | last FMTSW; |
| 1119 | } |
| 1120 | if ($elem eq 'tprevinbutton') { # Within thread previous button |
| 1121 | $TPREVINBUTTON = &get_elem_content($handle, $elem, $chop); |
| 1122 | last FMTSW; |
| 1123 | } |
| 1124 | if ($elem eq 'tprevinbuttonia') { |
| 1125 | $TPREVINBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 1126 | last FMTSW; |
| 1127 | } |
| 1128 | if ($elem eq 'tprevinlink') { # Within thread previous link |
| 1129 | $TPREVINLINK = &get_elem_content($handle, $elem, $chop); |
| 1130 | last FMTSW; |
| 1131 | } |
| 1132 | if ($elem eq 'tprevinlinkia') { |
| 1133 | $TPREVINLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1134 | last FMTSW; |
| 1135 | } |
| 1136 | if ($elem eq 'tprevlink') { # Thread previous link |
| 1137 | $TPREVLINK = &get_elem_content($handle, $elem, $chop); |
| 1138 | last FMTSW; |
| 1139 | } |
| 1140 | if ($elem eq 'tprevlinkia') { |
| 1141 | $TPREVLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1142 | last FMTSW; |
| 1143 | } |
| 1144 | if ($elem eq 'tprevpglink') { # Thread previous page link |
| 1145 | $TPREVPGLINK = &get_elem_content($handle, $elem, $chop); |
| 1146 | last FMTSW; |
| 1147 | } |
| 1148 | if ($elem eq 'tprevpglinkia') { |
| 1149 | $TPREVPGLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1150 | last FMTSW; |
| 1151 | } |
| 1152 | if ($elem eq 'treverse') { # Reverse order of threads |
| 1153 | $TREVERSE = 1; last FMTSW; |
| 1154 | } |
| 1155 | if ($elem eq 'tnexttopbutton') { # Next thread button |
| 1156 | $TNEXTTOPBUTTON = &get_elem_content($handle, $elem, $chop); |
| 1157 | last FMTSW; |
| 1158 | } |
| 1159 | if ($elem eq 'tnexttopbuttonia') { |
| 1160 | $TNEXTTOPBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 1161 | last FMTSW; |
| 1162 | } |
| 1163 | if ($elem eq 'tnexttoplink') { # Next thread link |
| 1164 | $TNEXTTOPLINK = &get_elem_content($handle, $elem, $chop); |
| 1165 | last FMTSW; |
| 1166 | } |
| 1167 | if ($elem eq 'tnexttoplinkia') { |
| 1168 | $TNEXTTOPLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1169 | last FMTSW; |
| 1170 | } |
| 1171 | if ($elem eq 'tprevtopbutton') { # Previous thread button |
| 1172 | $TPREVTOPBUTTON = &get_elem_content($handle, $elem, $chop); |
| 1173 | last FMTSW; |
| 1174 | } |
| 1175 | if ($elem eq 'tprevtopbuttonia') { |
| 1176 | $TPREVTOPBUTTONIA = &get_elem_content($handle, $elem, $chop); |
| 1177 | last FMTSW; |
| 1178 | } |
| 1179 | if ($elem eq 'tprevtoplink') { # Previous thread link |
| 1180 | $TPREVTOPLINK = &get_elem_content($handle, $elem, $chop); |
| 1181 | last FMTSW; |
| 1182 | } |
| 1183 | if ($elem eq 'tprevtoplinkia') { |
| 1184 | $TPREVTOPLINKIA = &get_elem_content($handle, $elem, $chop); |
| 1185 | last FMTSW; |
| 1186 | } |
| 1187 | if ($elem eq 'umask') { # Umask of process |
| 1188 | if ($line = &get_elem_last_line($handle, $elem)) { |
| 1189 | $line =~ s/\s//g; |
| 1190 | $UMASK = $line; |
| 1191 | } |
| 1192 | last FMTSW; |
| 1193 | } |
| 1194 | if ($elem eq 'uselocaltime') { # Use localtime for day groups |
| 1195 | $UseLocalTime = 1; last FMTSW; |
| 1196 | } |
| 1197 | if ($elem eq 'usinglastpg') { |
| 1198 | $UsingLASTPG = 1; last FMTSW; |
| 1199 | } |
| 1200 | if ($elem eq 'varregex') { # Regex matching rc vars |
| 1201 | $tmp = &get_elem_last_line($handle, $elem); |
| 1202 | # only take value if not blank |
| 1203 | $VarExp = $tmp if $tmp =~ /\S/; |
| 1204 | last FMTSW; |
| 1205 | } |
| 1206 | if ($elem eq 'weekdays') { # Full weekday name |
| 1207 | @a = &get_list_content($handle, $elem); |
| 1208 | if (scalar(@a)) { |
| 1209 | @Weekdays = @a; |
| 1210 | } |
| 1211 | last FMTSW; |
| 1212 | } |
| 1213 | if ($elem eq 'weekdaysabr') { # Abbreviated weekday name |
| 1214 | @a = &get_list_content($handle, $elem); |
| 1215 | if (scalar(@a)) { |
| 1216 | @weekdays = @a; |
| 1217 | } |
| 1218 | last FMTSW; |
| 1219 | } |
| 1220 | |
| 1221 | } ## End FMTSW |
| 1222 | } |
| 1223 | close($handle); |
| 1224 | 1; |
| 1225 | } |
| 1226 | |
| 1227 | ##---------------------------------------------------------------------- |
| 1228 | sub get_elem_content { |
| 1229 | my($filehandle, $gi, $chop) = @_; |
| 1230 | my($ret) = ''; |
| 1231 | |
| 1232 | while (<$filehandle>) { |
| 1233 | last if /^\s*<\/$gi\s*>/i; |
| 1234 | $ret .= $_; |
| 1235 | } |
| 1236 | $ret =~ s/\r?\n?$// if $chop; |
| 1237 | $ret; |
| 1238 | } |
| 1239 | |
| 1240 | ##---------------------------------------------------------------------- |
| 1241 | sub get_elem_int { |
| 1242 | my($filehandle, $gi, $abs) = @_; |
| 1243 | my($ret) = ''; |
| 1244 | |
| 1245 | while (<$filehandle>) { |
| 1246 | last if /^\s*<\/$gi\s*>/i; |
| 1247 | next unless /^\s*[-+]?\d+\s*$/; |
| 1248 | s/[+\s]//g; |
| 1249 | s/-// if $abs; |
| 1250 | $ret = $_; |
| 1251 | } |
| 1252 | $ret; |
| 1253 | } |
| 1254 | |
| 1255 | ##---------------------------------------------------------------------- |
| 1256 | sub get_elem_last_line { |
| 1257 | my($filehandle, $gi) = @_; |
| 1258 | my($ret) = ''; |
| 1259 | |
| 1260 | while (<$filehandle>) { |
| 1261 | last if /^\s*<\/$gi\s*>/i; |
| 1262 | next unless /\S/; |
| 1263 | $ret = $_; |
| 1264 | } |
| 1265 | $ret =~ s/\r?\n?$//; |
| 1266 | $ret; |
| 1267 | } |
| 1268 | |
| 1269 | ##---------------------------------------------------------------------- |
| 1270 | sub get_list_content { |
| 1271 | my($filehandle, $gi) = @_; |
| 1272 | my(@items) = (); |
| 1273 | |
| 1274 | while (<$filehandle>) { |
| 1275 | last if /^\s*<\/$gi\s*>/i; |
| 1276 | next unless /\S/; |
| 1277 | s/\r?\n?$//; |
| 1278 | push(@items, split(/[:;]/, $_)); |
| 1279 | } |
| 1280 | @items; |
| 1281 | } |
| 1282 | |
| 1283 | ##---------------------------------------------------------------------- |
| 1284 | sub get_pathname_content { |
| 1285 | my($filehandle, $gi) = @_; |
| 1286 | my(@items) = (); |
| 1287 | |
| 1288 | while (<$filehandle>) { |
| 1289 | last if /^\s*<\/$gi\s*>/i; |
| 1290 | next unless /\S/; |
| 1291 | s/\r?\n?$//; |
| 1292 | push(@items, split(/$PATHSEP/o, $_)); |
| 1293 | } |
| 1294 | @items; |
| 1295 | } |
| 1296 | |
| 1297 | ##---------------------------------------------------------------------------## |
| 1298 | 1; |