use my own APIS for headers, parameters and so on
[apps/madmutt.git] / lib-mime / mime.c
index 5eaab58..238bdbb 100644 (file)
@@ -17,6 +17,8 @@
  *  Copyright © 2006 Pierre Habouzit
  */
 
+#include "mime-types.h"
+
 const char MimeSpecials[] = "@.,;:<>[]\\\"()?/= \t";
 
 const char *BodyTypes[] = {
@@ -41,3 +43,62 @@ const char *BodyEncodings[] = {
     "x-uuencoded",
 };
 
+void address_wipe(address_t *addr)
+{
+    p_delete(&addr->personal);
+    p_delete(&addr->mailbox);
+    address_delete(&addr->next);
+}
+
+void parameter_wipe(PARAMETER *param)
+{
+    p_delete(&param->attribute);
+    p_delete(&param->value);
+    parameter_delete(&param->next);
+}
+
+void envelope_wipe(ENVELOPE *p)
+{
+    address_delete(&p->return_path);
+    address_delete(&p->from);
+    address_delete(&p->to);
+    address_delete(&p->cc);
+    address_delete(&p->bcc);
+    address_delete(&p->sender);
+    address_delete(&p->reply_to);
+    address_delete(&p->mail_followup_to);
+
+    p_delete(&p->list_post);
+    p_delete(&p->subject);
+    /* real_subj is just an offset to subject and shouldn't be freed */
+    p_delete(&p->message_id);
+    p_delete(&p->supersedes);
+    p_delete(&p->date);
+    p_delete(&p->x_label);
+    p_delete(&p->organization);
+#ifdef USE_NNTP
+    p_delete(&p->newsgroups);
+    p_delete(&p->xref);
+    p_delete(&p->followup_to);
+    p_delete(&p->x_comment_to);
+#endif
+
+    mutt_buffer_free (&p->spam);
+    mutt_free_list(&p->references);
+    mutt_free_list(&p->in_reply_to);
+    mutt_free_list(&p->userhdrs);
+}
+
+void header_wipe(HEADER *h)
+{
+    envelope_delete(&h->env);
+    mutt_free_body (&h->content);
+    p_delete(&h->maildir_flags);
+    p_delete(&h->tree);
+    p_delete(&h->path);
+#ifdef MIXMASTER
+    mutt_free_list(&h->chain);
+#endif
+    p_delete(&h->data);
+}
+