Courier-Filter

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN


  Courier::Filter:
  ! Config file has been renamed to "courier-filter-perl.conf" from
    "pureperlfilter.conf".

  Courier::Message:
  * Fixed a bug that caused crashes when encountering invalid (e.g., non-ASCII)
    characters in raw MIME encoded words.
  * Fixed fallback decoding of raw message headers from non-ASCII, non-UTF-8
    encodings such as ISO-8859-1.  Previously, any non-UTF-8 byte sequences
    would be decoded as the "�" Unicode substitution character.  Now this
    case properly falls back to reinterpreting the entire header as Windows-
    1252.
    Note:  In the absence of the experimental "UTF8SMTP" SMTP extension,
    non-ASCII characters are formally illegal in raw message headers, so this
    really only affects exceptional cases.
  * Eliminated some corner case "Use of uninitialized value" warnings.

  Courier::Config:
  * Lower-cased and slightly adjusted constant/method names.  Compatibility
    aliases for the old names are provided.

CHANGES  view on Meta::CPAN

                                                       (Closes: Debian #326785)
  * Ignore connections that don't send any data.

  Courier::Message:
  * Decode header text as "UTF-8" encoded, not as "utf8" encoded.  Starting
    with Perl 5.8.7, this does make a difference.  "utf8" allows invalid
    Unicode codepoints (such as UTF-16 surrogates), while "UTF-8" (the official
    standard UTF-8) doesn't.  We want to avoid invalid codepoints because they
    tend to cause trouble later.
  * Don't die on invalid characters in encoded-word chunks.  If an encoded-word
    cannot be decoded, retain it undecoded.
  * "authenticated" property: refined parsing of "Received:" header and "AUTH:"
    authentication information.
  + Added "authenticated_user" property.
  * Corrected documentation of "header" property.

  SPFout filter module:
  * Don't be pedantic about what our "public" IPv4 address is vis-à-vis the
    various recipient MXes.  Assume we just have a single public address that
    applies to all recipient MXes.  (Let's see if anyone out there actually has
    a more complex setup...)

debian/changelog  view on Meta::CPAN


  Courier::Filter:
  ! Config file has been renamed to "courier-filter-perl.conf" from
    "pureperlfilter.conf".

  Courier::Message:
  * Fixed a bug that caused crashes when encountering invalid (e.g., non-ASCII)
    characters in raw MIME encoded words.
  * Fixed fallback decoding of raw message headers from non-ASCII, non-UTF-8
    encodings such as ISO-8859-1.  Previously, any non-UTF-8 byte sequences
    would be decoded as the "�" Unicode substitution character.  Now this
    case properly falls back to reinterpreting the entire header as Windows-
    1252.
    Note:  In the absence of the experimental "UTF8SMTP" SMTP extension,
    non-ASCII characters are formally illegal in raw message headers, so this
    really only affects exceptional cases.
  * Eliminated some corner case "Use of uninitialized value" warnings.

  Courier::Config:
  * Lower-cased and slightly adjusted constant/method names.  Compatibility
    aliases for the old names are provided.

debian/changelog  view on Meta::CPAN

                                                              (Closes: #326785)
  * Ignore connections that don't send any data.

  Courier::Message:
  * Decode header text as "UTF-8" encoded, not as "utf8" encoded.  Starting
    with Perl 5.8.7, this does make a difference.  "utf8" allows invalid
    Unicode codepoints (such as UTF-16 surrogates), while "UTF-8" (the official
    standard UTF-8) doesn't.  We want to avoid invalid codepoints because they
    tend to cause trouble later.
  * Don't die on invalid characters in encoded-word chunks.  If an encoded-word
    cannot be decoded, retain it undecoded.
  * "authenticated" property: refined parsing of "Received:" header and "AUTH:"
    authentication information.
  * Added "authenticated_user" property.
  * Corrected documentation of "header" property.

  SPFout filter module:
  * Don't be pedantic about what our "public" IPv4 address is vis-à-vis the
    various recipient MXes.  Assume we just have a single public address that
    applies to all recipient MXes.  (Let's see if anyone out there actually has
    a more complex setup...)

lib/Courier/Filter/Module/Parts.pm  view on Meta::CPAN


%options is a list of key/value pairs representing any of the following
options:

=over

=item B<views>

An arrayref containing the global default set of I<views> the filter module
should apply to message parts when matching the configured signatures against
them.  A view is the way how a MIME part's (MIME-decoded) data is interpreted.
Defaults to B<['raw']>.

The following views are supported:

=over

=item B<raw>

The MIME part is MIME-decoded but not otherwise transformed.  The raw MIME part
is then matched against the configured signatures.

=item B<zip>

If the MIME part has a file name ending in C<.zip>, it is considered a ZIP
archive, and all unencrypted files in the archive are matched as individual
message parts against the configured signatures.  The zip view requires the
B<Archive::Zip> Perl module to be installed.

=back

lib/Courier/Filter/Module/Parts.pm  view on Meta::CPAN

=item B<mime_type>

The MIME type of the message part ('type/sub-type').

=item B<file_name>

The file name of the message part.

=item B<size>

The exact size (in bytes) of the decoded message part.

=item B<digest_md5>

The MD5 digest of the decoded message part (32 hex digits, as printed by
`md5sum`).

=item B<encrypted>

A boolean value denoting whether the message part is encrypted and its contents
are inaccessible to the B<Parts> filter module.

=back

I<Signature options>

lib/Courier/Message.pm  view on Meta::CPAN


sub body {
    my ($self) = @_;
    return $self->parse()->{body};
}

=begin comment

=item B<subject>: returns I<string>

Returns the decoded value of the message's "Subject" header field.

=end comment

=cut

sub subject {
    my ($self) = @_;
    return $self->header('subject');
}

lib/Courier/Message.pm  view on Meta::CPAN

}ox;

sub decode_mimewords {
    my ($text, $fallback_char_encoding) = @_;
    
    # Drop whitespace between two encoded words:
    $text =~ s/(${\encoded_word_pattern})\s+(${\encoded_word_pattern})/$1$6/;
    
    $text =~ s[(${\encoded_word_pattern})] {
        my ($encoded_word, $char_enc, $xfer_enc, $chunk) = ($1, $2, lc($4), $5);
        my $decoded_word;
        
        $char_enc =
            Encode::resolve_alias($char_enc) ||
            $fallback_char_encoding ||
            fallback_char_encoding;
        
        try {
            if ($xfer_enc eq 'b') {
                # Base 64!
                $chunk = MIME::Base64::decode($chunk);
            }
            elsif ($xfer_enc eq 'q') {
                # Quoted Printable!
                $chunk =~ tr/_/\x{20}/;
                $chunk = MIME::QuotedPrint::decode($chunk);
            }
            
            $decoded_word = Encode::decode($char_enc, $chunk);
        }
        otherwise {
            # The chunk contains invalid characters, leave the encoded word as is:
            $decoded_word = $encoded_word;
        };
        
        $decoded_word;
    }eg;
    
    return $text;
}

BEGIN {
    no warnings 'once';
    *decode = \&decode_mimewords;
}



( run in 3.261 seconds using v1.01-cache-2.11-cpan-59e3e3084b8 )