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_TYPES_H
31 #define MUTT_LIB_MIME_MIME_TYPES_H
37 #include <lib-lib/mem.h>
38 #include <lib-lib/buffer.h>
39 #include <lib-lib/list.h>
55 /* Content-Transfer-Encoding */
66 /* Content-Disposition values */
73 /****************************************************************************/
74 /* rfc822 addresses */
75 /****************************************************************************/
77 typedef struct address_t {
78 char *personal; /* real name of address */
79 char *mailbox; /* mailbox and host address */
80 int group; /* group mailbox? */
81 struct address_t *next;
84 DO_INIT(address_t, address);
85 void address_wipe(address_t *);
87 DO_NEW(address_t, address);
88 DO_DELETE(address_t, address);
89 DO_SLIST(address_t, address);
92 /****************************************************************************/
93 /* rfc822 header parameters */
94 /****************************************************************************/
96 typedef struct parameter {
99 struct parameter *next;
102 DO_INIT(PARAMETER, parameter);
103 void parameter_wipe(PARAMETER *);
105 DO_NEW(PARAMETER, parameter);
106 DO_DELETE(PARAMETER, parameter);
107 DO_SLIST(PARAMETER, parameter);
110 /****************************************************************************/
111 /* rfc822 envelopes */
112 /****************************************************************************/
114 typedef struct envelope_t {
115 address_t *return_path;
122 address_t *mail_followup_to;
123 char *list_post; /* this stores a mailto URL, or nothing */
125 char *real_subj; /* offset of the real subject */
138 LIST *references; /* message references (in reverse order) */
139 LIST *in_reply_to; /* in-reply-to header content */
140 LIST *userhdrs; /* user defined headers */
141 unsigned int irt_changed:1; /* In-Reply-To changed to link/break threads */
142 unsigned int refs_changed:1; /* References changed to break thread */
145 DO_INIT(ENVELOPE, envelope);
146 void envelope_wipe(ENVELOPE*);
148 DO_NEW(ENVELOPE, envelope);
149 DO_DELETE(ENVELOPE, envelope);
151 /****************************************************************************/
152 /* rfc822 content-* */
153 /****************************************************************************/
155 /* Information that helps in determing the Content-* of an attachment */
156 typedef struct content {
157 long hibin; /* 8-bit characters */
158 long lobin; /* unprintable 7-bit chars (eg., control chars) */
159 long crlf; /* '\r' and '\n' characters */
160 long ascii; /* number of ascii chars */
161 long linemax; /* length of the longest line in the file */
162 unsigned int space:1; /* whitespace at the end of lines? */
163 unsigned int binary:1; /* long lines, or CR not in CRLF pair */
164 unsigned int from:1; /* has a line beginning with "From "? */
165 unsigned int dot:1; /* has a line consisting of a single dot? */
166 unsigned int cr:1; /* has CR, even when in a CRLF pair */
170 /****************************************************************************/
172 /****************************************************************************/
174 typedef struct body {
175 char *xtype; /* content-type if x-unknown */
176 char *subtype; /* content-type subtype */
177 PARAMETER *parameter; /* parameters of the content-type */
178 char *description; /* content-description */
179 char *form_name; /* Content-Disposition form-data name param */
180 off_t hdr_offset; /* offset in stream where the headers begin.
181 * this info is used when invoking metamail,
182 * where we need to send the headers of the
185 off_t offset; /* offset where the actual data begins */
186 off_t length; /* length (in bytes) of attachment */
187 char *filename; /* when sending a message, this is the file
188 * to which this structure refers
190 char *d_filename; /* filename to be used for the
191 * content-disposition header.
192 * If NULL, filename is used
195 char *file_charset; /* charset of attached file */
196 CONTENT *content; /* structure used to store detailed info about
197 * the content of the attachment. this is used
198 * to determine what content-transfer-encoding
199 * is required when sending mail.
201 struct body *next; /* next attachment in the list */
202 struct body *parts; /* parts of a multipart or message/rfc822 */
203 struct header *hdr; /* header information for message/rfc822 */
205 struct attachptr *aptr; /* Menu information, used in recvattach.c */
207 signed short attach_count;
209 time_t stamp; /* time stamp of last
213 unsigned int type:4; /* content-type primary type */
214 unsigned int encoding:3; /* content-transfer-encoding */
215 unsigned int disposition:2; /* content-disposition */
216 unsigned int use_disp:1; /* Content-Disposition uses filename= ? */
217 unsigned int unlink:1; /* flag to indicate the the file named by
218 * "filename" should be unlink()ed before
219 * free()ing this structure
221 unsigned int tagged:1;
222 unsigned int deleted:1; /* attachment marked for deletion */
224 unsigned int noconv:1; /* don't do character set conversion */
225 unsigned int force_charset:1; /* send mode: don't adjust the character set
226 when in send-mode. */
227 unsigned int is_signed_data:1; /* A lot of MUAs don't indicate S/MIME
228 signed-data correctly, e.g. they use
229 foo.p7m even for the name of signed
230 data. This flag is used to keep track
231 of the actual message type. It gets set
232 during the verification (which is done
233 if the encryption try failed) and check
234 by the function to figure the type of
237 unsigned int goodsig:1; /* good cryptographic signature */
238 unsigned int warnsig:1; /* maybe good signature */
239 unsigned int badsig:1; /* bad cryptographic signature (needed to check encrypted s/mime-signatures) */
241 unsigned int collapsed:1; /* used by recvattach */
242 unsigned int attach_qualifies:1;
246 /****************************************************************************/
248 /****************************************************************************/
250 typedef struct header {
251 unsigned int security:11; /* bit 0-6: flags, bit 7,8: application.
252 see: crypt.h pgplib.h, smime.h */
254 unsigned int mime:1; /* has a MIME-Version header? */
255 unsigned int flagged:1; /* marked important? */
256 unsigned int tagged:1;
257 unsigned int appended:1; /* has been saved */
258 unsigned int purged:1; /* bypassing the trash folder */
259 unsigned int deleted:1;
260 unsigned int changed:1;
261 unsigned int attach_del:1; /* has an attachment marked for deletion */
264 unsigned int expired:1; /* already expired? */
265 unsigned int superseded:1; /* got superseded? */
266 unsigned int replied:1;
267 unsigned int subject_changed:1; /* used for threading */
268 unsigned int threaded:1; /* used for threading */
269 unsigned int display_subject:1; /* used for threading */
270 unsigned int recip_valid:1; /* is_recipient is valid */
271 unsigned int active:1; /* message is not to be removed */
272 unsigned int trash:1; /* message is marked as trashed on disk.
273 * This flag is used by the maildir_trash
277 /* timezone of the sender of this message */
278 unsigned int zhours:5;
279 unsigned int zminutes:6;
280 unsigned int zoccident:1;
282 /* bits used for caching when searching */
283 unsigned int searched:1;
284 unsigned int matched:1;
286 /* tells whether the attach count is valid */
287 unsigned int attach_valid:1;
289 /* the following are used to support collapsing threads */
290 unsigned int collapsed:1; /* is this message part of a collapsed thread? */
291 unsigned int limited:1; /* is this message in a limited view? */
292 size_t num_hidden; /* number of hidden messages in this view */
294 short recipient; /* user_is_recipient()'s return value, cached */
296 int pair; /* color-pair to use when displaying in the index */
298 time_t date_sent; /* time when the message was sent (UTC) */
299 time_t received; /* time when the message was placed in the mailbox */
300 off_t offset; /* where in the stream does this message begin? */
301 int lines; /* how many lines in the body of this message? */
302 int index; /* the absolute (unsorted) message number */
303 int msgno; /* number displayed to the user */
304 int virtual; /* virtual message number */
306 ENVELOPE *env; /* envelope information */
307 BODY *content; /* list of MIME parts */
313 char *tree; /* character string to print thread tree */
314 struct thread *thread;
322 int refno; /* message number on server */
323 void *data; /* driver-specific data */
325 char *maildir_flags; /* unknown maildir flags */
328 DO_INIT(HEADER, header);
329 void header_wipe(HEADER *);
331 DO_NEW(HEADER, header);
332 DO_DELETE(HEADER, header);
334 #endif /* MUTT_LIB_MIME_MIME_TYPES_H */