2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or (at
5 * your option) any later version.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * Copyright © 2006 Pierre Habouzit
21 * Copyright notice from original mutt:
22 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
23 * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
25 * This file is part of mutt-ng, see http://www.muttng.org/.
26 * It's licensed under the GNU General Public License,
27 * please see the file GPL in the top level source directory.
30 #ifndef MUTT_LIB_MIME_MIME_H
31 #define MUTT_LIB_MIME_MIME_H
36 #include "mime-types.h"
37 #include "mime-token.h"
39 extern const char MimeSpecials[];
40 extern const char *BodyTypes[];
41 extern const char *BodyEncodings[];
43 /* MIME encoding/decoding global vars */
45 #define is_multipart(x) \
46 ((x)->type == TYPEMULTIPART \
47 || ((x)->type == TYPEMESSAGE && \
48 ((!mime_which_token((x)->subtype, -1) == MIME_RFC822) \
49 || !mime_which_token((x)->subtype, -1) == MIME_NEWS)))
51 #define TYPE(X) ((X->type == TYPEOTHER) && (X->xtype != NULL) ? X->xtype : BodyTypes[(X->type)])
52 #define ENCODING(X) BodyEncodings[(X)]
54 int url_parse_mailto(ENVELOPE *e, char **body, const char *src);
56 /****************************************************************************/
58 /* Standard for ARPA Internet Text Messages */
59 /****************************************************************************/
61 extern const char RFC822Specials[];
63 ssize_t mutt_read_rfc822_line(FILE*, char**, ssize_t*);
64 string_list_t *mutt_parse_references(char *, int);
65 int mutt_check_encoding(const char *);
66 int mutt_check_mime_type(const char *);
67 void mutt_parse_content_type(char *, BODY *);
68 BODY *mutt_read_mime_header (FILE *, int);
69 void mutt_parse_part(FILE *, BODY *);
70 BODY *mutt_parse_messageRFC822(FILE *, BODY *);
71 BODY *mutt_parse_multipart(FILE *, const char *, off_t, int);
72 string_list_t **mutt_parse_rfc822_line(ENVELOPE *, HEADER *, char *line, char *p,
73 short weed, short do_2047, string_list_t **);
74 ENVELOPE *mutt_read_rfc822_header(FILE *, HEADER *, short, short);
75 int mutt_count_body_parts (HEADER *hdr, int flags);
79 address_t *mutt_parse_adrlist(address_t *, const char *);
80 address_t *address_dup(const address_t *addr);
81 address_t *address_list_dup(const address_t *addr);
82 void rfc822_qualify(address_t *, const char *);
84 address_t *rfc822_parse_adrlist(address_t *, const char *s);
86 ssize_t rfc822_write_address(char *, ssize_t, address_t *, int);
87 ssize_t rfc822_write_address_single(char *, ssize_t, address_t *, int);
88 ssize_t rfc822_strcpy(char *, ssize_t, const char *, const char *);
90 /****************************************************************************/
92 /* MIME (Multipurpose Internet Mail Extensions) Part Three: */
93 /* Message Header Extensions for Non-ASCII Text */
94 /****************************************************************************/
96 char *mutt_choose_charset(const char *fromcode, const char *charsets,
97 char *u, ssize_t ulen, char **d, ssize_t *dlen);
99 void rfc2047_encode_string(char **);
100 void rfc2047_encode_adrlist(address_t *, const char *);
102 void rfc2047_decode(char **);
103 void rfc2047_decode_adrlist(address_t *);
104 void rfc2047_decode_envelope(ENVELOPE* e);
106 /****************************************************************************/
108 /* MIME Parameter Value and Encoded Word Extensions: */
109 /* Character Sets, Languages, and Continuations */
110 /****************************************************************************/
112 int rfc2231_encode_string(char **);
113 void rfc2231_decode_parameters(PARAMETER **);
115 #endif /* MUTT_LIB_MIME_MIME_H */