Changeset 1658


Ignore:
Timestamp:
2000-11-08T11:49:49+13:00 (23 years ago)
Author:
paynter
Message:

Fixed a bug reading the headers that confused "To" with "In-Reply-To".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/EMAILPlug.pm

    r1424 r1658  
    4646#   $DateText     Date: header
    4747#   $Date         Date: header in GSDL format (eg: 19990924)
    48 #
    49 # Version history
    50 #
    51 # 1.2   (2000 Jun 12) Major rewrite.
    52 #       (The new version of Greenstone breaks some of the metadata.)
    53 # 1.1.1 Compensated for two-digit years like "95"
    54 # 1.1   (1999 Sep 20) Introduced the various metadata fileds
    55 # 1.0   Based on the original HTMLPlug code
    56 #
    57 
    5848
    5949package EMAILPlug;
     
    112102    # Extract basic metadata from header
    113103    my @headers = ("From", "To", "Subject", "Date");
    114     my $value = "";
    115104    my %raw;
    116 
    117105    foreach my $name (@headers) {
    118     $value = $Headers;
    119     $value =~ s/.*$name://s;
    120     $value =~ s/\S*:.*//s;
    121     $value =~ s/\s*$//;
    122     $value =~ s/\s+/ /g;
     106    $raw{$name} = "No $name value";
     107    }
     108
     109    # Examine each line of the headers
     110    my ($line, $name, $value);
     111    my @parts;
     112    foreach $line (split(/\n/, $Headers)) {
     113   
     114    # Ignore lines with no content or which begin with whitespace
     115    next unless ($line =~ /:/);
     116    next if ($line =~ /^\s/);
     117
     118    # Find out what metadata is on this line
     119    @parts = split(/:/, $line);
     120    $name = shift @parts;
     121    next unless $name;
     122    next unless ($raw{$name});
     123
     124    # Find the value of that metadata
     125    $value = join(":", @parts);
     126    $value =~ s/^\s+//;
     127    $value =~ s/\s+$//;
     128
     129    # Store the metadata
    123130    $raw{$name} = $value;
    124131    }
    125132
    126133    # Process Date information
    127     if ($raw{"Date"}) {
     134    if ($raw{"Date"} !~ /No Date/) {
    128135    $raw{"DateText"} = $raw{"Date"};
    129136   
Note: See TracChangeset for help on using the changeset viewer.