Changeset 3111


Ignore:
Timestamp:
2002-05-07T15:33:35+12:00 (22 years ago)
Author:
jrm21
Message:

Allow .eml extension (IE and mozilla default to this for individual files).

Tidy up the checks for testing for valid mail file format.

File:
1 edited

Legend:

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

    r3073 r3111  
    9494    # mbx/email for mailbox file format, \d+ for maildir (each message is
    9595    # in a separate file, with a unique number for filename)
    96     return q@([\\/]\d+|\.(mbx|email))$@;
     96    # mozilla and IE will save individual mbx format files with a ".eml" ext.
     97    return q@([\\/]\d+|\.(mbx|email|eml))$@;
    9798}
    9899
    99100# This plugin splits the mbox mail files at lines starting with From<sp>
     101# It is supposed to be "\n\nFrom ", but this isn't always used.
    100102sub get_default_split_exp {
    101103    return q^\nFrom .*\n^;
     
    111113
    112114    # Check that we're dealing with a valid mail file
    113     return undef unless (($$textref =~ /From:/m) || ($$textref =~ /To:/m));
    114 
    115     # slightly more strict validity check, to prevent us from matching
    116     # .so.x files ...
    117     return undef unless (($$textref =~ /^From /) ||
    118              ($$textref =~ /^[-A-Za-z]{2,100}:/m));
     115    # mbox message files start with "From "
     116    # maildir messages usually start with Return-Path and Delivered-To
     117    # mh is very similar to maildir
     118    my $startoffile=substr($$textref,0,256);
     119    if (($startoffile !~ /^(From )/) &&
     120    ($startoffile !~ /^(From|To|Envelope.*|Received|Return-Path|Date|Subject|Content\-.*|MIME-Version|Forwarded):/im)) {
     121    return undef;
     122    }
     123
    119124
    120125    print $outhandle "EMAILPlug: processing $file\n"
Note: See TracChangeset for help on using the changeset viewer.