reorganize code so that the rfc822parse.c does not needs lib-crypt nor
[apps/madmutt.git] / lib-mime / mime.c
1 /*
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.
6  *
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.
11  *
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,
15  *  MA 02110-1301, USA.
16  *
17  *  Copyright © 2006 Pierre Habouzit
18  */
19
20 #include "mime-types.h"
21
22 const char MimeSpecials[] = "@.,;:<>[]\\\"()?/= \t";
23
24 const char *BodyTypes[] = {
25     "x-unknown",
26     "audio",
27     "application",
28     "image",
29     "message",
30     "model",
31     "multipart",
32     "text",
33     "video",
34 };
35
36 const char *BodyEncodings[] = {
37     "x-unknown",
38     "7bit",
39     "8bit",
40     "quoted-printable",
41     "base64",
42     "binary",
43     "x-uuencoded",
44 };
45
46 void address_wipe(address_t *addr)
47 {
48     p_delete(&addr->personal);
49     p_delete(&addr->mailbox);
50     address_delete(&addr->next);
51 }
52
53 void parameter_wipe(PARAMETER *param)
54 {
55     p_delete(&param->attribute);
56     p_delete(&param->value);
57     parameter_delete(&param->next);
58 }
59
60 void envelope_wipe(ENVELOPE *p)
61 {
62     address_delete(&p->return_path);
63     address_delete(&p->from);
64     address_delete(&p->to);
65     address_delete(&p->cc);
66     address_delete(&p->bcc);
67     address_delete(&p->sender);
68     address_delete(&p->reply_to);
69     address_delete(&p->mail_followup_to);
70
71     p_delete(&p->list_post);
72     p_delete(&p->subject);
73     /* real_subj is just an offset to subject and shouldn't be freed */
74     p_delete(&p->message_id);
75     p_delete(&p->supersedes);
76     p_delete(&p->date);
77     p_delete(&p->x_label);
78     p_delete(&p->organization);
79 #ifdef USE_NNTP
80     p_delete(&p->newsgroups);
81     p_delete(&p->xref);
82     p_delete(&p->followup_to);
83     p_delete(&p->x_comment_to);
84 #endif
85
86     mutt_buffer_free (&p->spam);
87     mutt_free_list(&p->references);
88     mutt_free_list(&p->in_reply_to);
89     mutt_free_list(&p->userhdrs);
90 }
91
92 void header_wipe(HEADER *h)
93 {
94     envelope_delete(&h->env);
95     mutt_free_body (&h->content);
96     p_delete(&h->maildir_flags);
97     p_delete(&h->tree);
98     p_delete(&h->path);
99 #ifdef MIXMASTER
100     mutt_free_list(&h->chain);
101 #endif
102     p_delete(&h->data);
103 }
104