GMime.FilterBest

g GMime.Filter GMime.Filter GMime.FilterBest GMime.FilterBest GMime.Filter->GMime.FilterBest GObject.Object GObject.Object GObject.Object->GMime.Filter

Subclasses:

None

Methods

Inherited:

GMime.Filter (6), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (flags)

charset ()

encoding (constraint)

Virtual Methods

Inherited:

GMime.Filter (4), GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

count0

int

r

count of nul-bytes passed through the filter

count8

int

r

count of 8bit bytes passed through the filter

flags

GMime.FilterBestFlags

r

GMime.FilterBestFlags

frombuf

bytes

r

buffer for checking From_ lines

fromlen

int

r

length of bytes in frombuf

hadfrom

int

r

True if any line started with “From “

linelen

int

r

current line length

maxline

int

r

the length of the longest line passed through the filter

midline

int

r

mid-line state

parent_object

GMime.Filter

r

parent GMime.Filter

startline

int

r

start line state

total

int

r

total number of bytes passed through the filter

Class Details

class GMime.FilterBest(**kwargs)
Bases:

GMime.Filter

Abstract:

No

Structure:

GMime.FilterBestClass

A filter for calculating the best encoding and/or charset to encode the data passed through it.

classmethod new(flags)
Parameters:

flags (GMime.FilterBestFlags) – filter flags

Returns:

a new best filter with flags flags.

Return type:

GMime.Filter

Creates a new GMime.FilterBest filter. flags are used to determine which information to keep statistics of. If the GMime.FilterBestFlags.CHARSET bit is set, the filter will be able to compute the best charset for encoding the stream of data filtered. If the GMime.FilterBestFlags.ENCODING bit is set, the filter will be able to compute the best Content-Transfer-Encoding for use with the stream being filtered.

Note: In order for the GMime.FilterBest.charset() function to work, the stream being filtered MUST already be encoded in UTF-8.

charset()
Returns:

the name of the charset most suitable for encoding the content that has been passed through the filter or None if the filter was not configured to detect this.

Return type:

str

Calculates the best charset for encoding the content filtered through the self filter.

encoding(constraint)
Parameters:

constraint (GMime.EncodingConstraint) – a GMime.EncodingConstraint

Returns:

the best encoding for the content filtered by self.

Return type:

GMime.ContentEncoding

Calculates the most efficient Content-Transfer-Encoding for the content filtered through self that fits within the encoding constraint.