Inherits Garbage. Inherited by AddressField, DateField, ListIdField and MimeField.
This class models a single RFC 822 header field (e.g. From).
This class is responsible for parsing and verifying header fields. Each field has a type(), name(), and value(). It is valid() if no error() was recorded during parsing by the various functions that parse() field values, e.g. parseText()).
Users may obtain HeaderField objects only via create().
Constructs a HeaderField of type t.
This static function returns a pointer to a new HeaderField object that represents the given field name (case-insensitive) and the field data retrieved from the database.
This function is for use by the message fetcher.
This static function returns a pointer to a new HeaderField object that represents the given field name (case-insensitive) and its value (which is parsed appropriately). Neither name nor value may contain the separating ':'.
This function is for use by the message parser.
This static function returns the RFC 2047-encoded version of s.
This static function returns the RFC 2047-encoded version of s.
This static function returns an RFC 2047 encoded-word representing w.
Returns a suitable error message if this header field has a known parse error, and an empty string if the field is valid() or -- as is the case for all unknown fields -- not parsed.
Returns the name corresponding to the field type t, or 0 if there is no such field.
This private function is used by create() and assemble() to create a HeaderField object of a type appropriate to the given name.
Returns the Type corresponding to field name n, or 0 if n isn't known.
Returns the canonical name of this header field.
Every HeaderField subclass must define a parse() function that takes a string s from a message and sets the field value(). This default function handles fields that are not specially handled by subclasses using functions like parseText().
Parses the Content-Base header field in s and records the first problem found. Somewhat overflexibly assumes that if there is a colon, the URL is absolute, so it accepts -:/asr as a valid URL.
Parses the Content-Location header field in s and records the first problem found.
Parses Errors-To field s. Stores localpart@domain if it looks like a single address (and reasonably error-free) and an empty value if there's any doubt what to store.
Parses the Mime-Version field from s and resolutely ignores all problems seen.
Only version 1.0 is legal. Since vast numbers of spammers send other version numbers, we replace other version numbers with 1.0 and a comment. Bayesian analysis tools will probably find the comment to be a sure spam sign.
Tries to parses any (otherwise uncovered and presumably unstructured) field in s, and records an error if it contains NULs or 8-bit characters.
Parses the *text production from s, as modified to include encoded-words by RFC 2047. This is used to parse the Subject and Comments fields.
Returns the header field's position, as recorded by setPosition(). The initial value is UINT_MAX, which is magic. When Header sees UINT_MAX, it changes the position() to one higher than the highest existing position.
Returns the RFC 2822 representation of this header field, with its contents properly folded and, if necessary, RFC 2047 encoded. This is a string we can hand out to clients.
Records the error text s encountered during parsing.
Sets the name of this HeaderField to n.
Records the position of this header field, p. This function doesn't move the header field in the lost used by Header, it merely records the position so that Header can access it when needed.
Records that the field's unparsed value is s. unparsedValue() will return s, unless the string is/becomes valid().
Sets the parsed representation of this HeaderField to s and clears the error().
Returns the type of this header field, as set by the constructor based on the name(). Unknown fields have type HeaderField::Other.
Returns the header field's value() completely unparsed, if !valid(). If the field is valid(), this function returns an empty string.
Returns true if this header field is valid (or unparsed, as is the case for all unknown fields), and false if an error was detected during parsing.
If the header field is valid(), this function returns the contents of this header field in a representation that is meant for storage in the database (unfolded and UTF-8 encoded, with RFC 2047 encoded-words expanded).
If the field is not valid(), this function returns an empty string.
Use rfc822() if you want a valid RFC 2822 representation.
Returns a version of s with long lines wrapped according to the rules in RFC [2]822. This function is not static, because it needs to look at the field name.
XXX: Well, except that we ignore the rules right now.
Exists only to avoid compiler warnings.
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.