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