Miscellaneous email parsing routines. More...
Go to the source code of this file.
Functions | |
void | mutt_auto_subscribe (const char *mailto) |
Check if user is subscribed to mailing list. | |
int | mutt_check_encoding (const char *c) |
Check the encoding type. | |
enum ContentType | mutt_check_mime_type (const char *s) |
Check a MIME type string. | |
char * | mutt_extract_message_id (const char *s, size_t *len) |
Find a message-id. | |
bool | mutt_is_message_type (int type, const char *subtype) |
Determine if a mime type matches a message or not. | |
bool | mutt_matches_ignore (const char *s) |
Does the string match the ignore list. | |
void | mutt_parse_content_type (const char *s, struct Body *b) |
Parse a content type. | |
bool | mutt_parse_mailto (struct Envelope *env, char **body, const char *src) |
Parse a mailto:// url. | |
struct Body * | mutt_parse_multipart (FILE *fp, const char *boundary, LOFF_T end_off, bool digest) |
Parse a multipart structure. | |
void | mutt_parse_part (FILE *fp, struct Body *b) |
Parse a MIME part. | |
struct Body * | mutt_read_mime_header (FILE *fp, bool digest) |
Parse a MIME header. | |
int | mutt_rfc822_parse_line (struct Envelope *env, struct Email *e, const char *name, size_t name_len, const char *body, bool user_hdrs, bool weed, bool do_2047) |
Parse an email header. | |
struct Body * | mutt_rfc822_parse_message (FILE *fp, struct Body *b) |
Parse a Message/RFC822 body. | |
struct Envelope * | mutt_rfc822_read_header (FILE *fp, struct Email *e, bool user_hdrs, bool weed) |
Parses an RFC822 header. | |
size_t | mutt_rfc822_read_line (FILE *fp, struct Buffer *out) |
Read a header line from a file. | |
void | mutt_filter_commandline_header_tag (char *header) |
Sanitise characters in a header tag. | |
void | mutt_filter_commandline_header_value (char *header) |
Sanitise characters in a header value. | |
Miscellaneous email parsing routines.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file parse.h.
void mutt_auto_subscribe | ( | const char * | mailto | ) |
Check if user is subscribed to mailing list.
mailto | URL of mailing list subscribe |
Definition at line 109 of file parse.c.
int mutt_check_encoding | ( | const char * | c | ) |
Check the encoding type.
c | String to check |
enum | ContentEncoding, e.g. ENC_QUOTED_PRINTABLE |
Definition at line 437 of file parse.c.
enum ContentType mutt_check_mime_type | ( | const char * | s | ) |
Check a MIME type string.
s | String to check |
enum | ContentType, e.g. TYPE_TEXT |
Definition at line 366 of file parse.c.
char * mutt_extract_message_id | ( | const char * | s, |
size_t * | len | ||
) |
Find a message-id.
[in] | s | String to parse |
[out] | len | Number of bytes of s parsed |
ptr | Message id found |
NULL | No more message ids |
Definition at line 401 of file parse.c.
bool mutt_is_message_type | ( | int | type, |
const char * | subtype | ||
) |
Determine if a mime type matches a message or not.
true | Type is message/news or message/rfc822 |
false | Otherwise |
Definition at line 1498 of file parse.c.
bool mutt_matches_ignore | ( | const char * | s | ) |
Does the string match the ignore list.
s | String to check |
true | String matches |
Checks Ignore and UnIgnore using mutt_list_match
Definition at line 356 of file parse.c.
void mutt_parse_content_type | ( | const char * | s, |
struct Body * | b | ||
) |
Parse a content type.
s | String to parse |
b | Body to save the result |
e.g. parse a string "inline" and set DISP_INLINE.
Definition at line 463 of file parse.c.
bool mutt_parse_mailto | ( | struct Envelope * | env, |
char ** | body, | ||
const char * | src | ||
) |
Parse a mailto:// url.
true | Success |
false | Error |
Definition at line 1754 of file parse.c.
struct Body * mutt_parse_multipart | ( | FILE * | fp, |
const char * | boundary, | ||
LOFF_T | end_off, | ||
bool | digest | ||
) |
Parse a multipart structure.
fp | Stream to read from |
boundary | Body separator |
end_off | Length of the multipart body (used when the final boundary is missing to avoid reading too far) |
digest | true if reading a multipart/digest |
ptr | New Body containing parsed structure |
Definition at line 1853 of file parse.c.
void mutt_parse_part | ( | FILE * | fp, |
struct Body * | b | ||
) |
Parse a MIME part.
fp | File to read from |
b | Body to store the results in |
Definition at line 1822 of file parse.c.
struct Body * mutt_read_mime_header | ( | FILE * | fp, |
bool | digest | ||
) |
Parse a MIME header.
fp | stream to read from |
digest | true if reading subparts of a multipart/digest |
ptr | New Body containing parsed structure |
Definition at line 1362 of file parse.c.
int mutt_rfc822_parse_line | ( | struct Envelope * | env, |
struct Email * | e, | ||
const char * | name, | ||
size_t | name_len, | ||
const char * | body, | ||
bool | user_hdrs, | ||
bool | weed, | ||
bool | do_2047 | ||
) |
Parse an email header.
env | Envelope of the email |
e | |
name | Header field name, e.g. 'to' |
name_len | Must be equivalent to strlen(name) |
body | Header field body, e.g. 'john@.nosp@m.exam.nosp@m.ple.c.nosp@m.om' |
user_hdrs | If true, save into the Envelope's userhdrs |
weed | If true, perform header weeding (filtering) |
do_2047 | If true, perform RFC2047 decoding of the field |
1 | The field is recognised |
0 | The field is not recognised |
Process a line from an email header. Each line that is recognised is parsed and the information put in the Envelope or Header.
Definition at line 678 of file parse.c.
Parse a Message/RFC822 body.
fp | Stream to read from |
b | Info about the message/rfc822 body part |
ptr | New Body containing parsed message |
Definition at line 1837 of file parse.c.
struct Envelope * mutt_rfc822_read_header | ( | FILE * | fp, |
struct Email * | e, | ||
bool | user_hdrs, | ||
bool | weed | ||
) |
Parses an RFC822 header.
fp | Stream to read from |
e | Current Email (optional) |
user_hdrs | If set, store user headers Used for recall-message and postpone modes |
weed | If this parameter is set and the user has activated the $weed option, honor the header weed list for user headers. Used for recall-message |
ptr | Newly allocated envelope structure |
Caller should free the Envelope using mutt_env_free().
Definition at line 1205 of file parse.c.
size_t mutt_rfc822_read_line | ( | FILE * | fp, |
struct Buffer * | buf | ||
) |
Read a header line from a file.
fp | File to read from |
buf | Buffer to store the result |
num | Number of bytes read from fp |
Reads an arbitrarily long header field, and looks ahead for continuation lines.
Definition at line 1125 of file parse.c.
void mutt_filter_commandline_header_tag | ( | char * | header | ) |
Sanitise characters in a header tag.
header | String to sanitise |
Definition at line 73 of file parse.c.
void mutt_filter_commandline_header_value | ( | char * | header | ) |
Sanitise characters in a header value.
header | String to sanitise |
It might be preferable to use mutt_filter_unprintable() instead. This filter is being lax, but preventing a header injection via an embedded newline.
Definition at line 93 of file parse.c.