many simplifications, copyright statements.
[apps/madmutt.git] / lib-mime / mime-types.h
index 3744cbc..513f121 100644 (file)
@@ -60,7 +60,7 @@ enum {
     ENCQUOTEDPRINTABLE,
     ENCBASE64,
     ENCBINARY,
-    ENCUUENCODED
+    ENCUUENCODED,
 };
 
 /* Content-Disposition values */
@@ -70,11 +70,9 @@ enum {
     DISPFORMDATA
 };
 
-typedef struct parameter {
-    char *attribute;
-    char *value;
-    struct parameter *next;
-} PARAMETER;
+/****************************************************************************/
+/* rfc822 addresses                                                         */
+/****************************************************************************/
 
 typedef struct address_t {
     char *personal;               /* real name of address */
@@ -83,6 +81,41 @@ typedef struct address_t {
     struct address_t *next;
 } address_t;
 
+DO_INIT(address_t, address);
+static inline void address_wipe(address_t *addr) {
+    p_delete(&addr->personal);
+    p_delete(&addr->mailbox);
+}
+
+DO_NEW(address_t, address);
+DO_DELETE(address_t, address);
+DO_SLIST(address_t, address, address_delete);
+
+/****************************************************************************/
+/* rfc822 header parameters                                                 */
+/****************************************************************************/
+
+typedef struct parameter {
+    char *attribute;
+    char *value;
+    struct parameter *next;
+} PARAMETER;
+
+DO_INIT(PARAMETER, parameter);
+static inline void parameter_wipe(PARAMETER *param) {
+    p_delete(&param->attribute);
+    p_delete(&param->value);
+}
+
+DO_NEW(PARAMETER, parameter);
+DO_DELETE(PARAMETER, parameter);
+DO_SLIST(PARAMETER, parameter, parameter_delete);
+
+
+/****************************************************************************/
+/* rfc822 envelopes                                                         */
+/****************************************************************************/
+
 typedef struct envelope_t {
     address_t *return_path;
     address_t *from;
@@ -107,13 +140,23 @@ typedef struct envelope_t {
     char *x_comment_to;
 #endif
     BUFFER *spam;
-    LIST *references;             /* message references (in reverse order) */
-    LIST *in_reply_to;            /* in-reply-to header content */
-    LIST *userhdrs;               /* user defined headers */
+    string_list_t *references;             /* message references (in reverse order) */
+    string_list_t *in_reply_to;            /* in-reply-to header content */
+    string_list_t *userhdrs;               /* user defined headers */
     unsigned int irt_changed:1;   /* In-Reply-To changed to link/break threads */
     unsigned int refs_changed:1;  /* References changed to break thread */
 } ENVELOPE;
 
+DO_INIT(ENVELOPE, envelope);
+void envelope_wipe(ENVELOPE*);
+
+DO_NEW(ENVELOPE, envelope);
+DO_DELETE(ENVELOPE, envelope);
+
+/****************************************************************************/
+/* rfc822 content-*                                                         */
+/****************************************************************************/
+
 /* Information that helps in determing the Content-* of an attachment */
 typedef struct content {
     long hibin;                   /* 8-bit characters */
@@ -128,6 +171,11 @@ typedef struct content {
     unsigned int cr:1;            /* has CR, even when in a CRLF pair */
 } CONTENT;
 
+
+/****************************************************************************/
+/* rfc822 Bodies                                                            */
+/****************************************************************************/
+
 typedef struct body {
     char *xtype;                  /* content-type if x-unknown */
     char *subtype;                /* content-type subtype */
@@ -197,9 +245,13 @@ typedef struct body {
 
     unsigned int collapsed:1;     /* used by recvattach */
     unsigned int attach_qualifies:1;
-
 } BODY;
 
+
+/****************************************************************************/
+/* rfc822 Headers                                                           */
+/****************************************************************************/
+
 typedef struct header {
     unsigned int security:11;     /* bit 0-6: flags, bit 7,8: application.
 see: crypt.h pgplib.h, smime.h */
@@ -269,7 +321,7 @@ see: crypt.h pgplib.h, smime.h */
     short attach_total;
 
 #ifdef MIXMASTER
-    LIST *chain;
+    string_list_t *chain;
 #endif
 
     int refno;                    /* message number on server */
@@ -278,12 +330,10 @@ see: crypt.h pgplib.h, smime.h */
     char *maildir_flags;          /* unknown maildir flags */
 } HEADER;
 
-DO_INIT(address_t, address);
-void address_wipe(address_t *);
-
-DO_NEW(address_t, address);
-DO_DELETE(address_t, address);
-DO_SLIST(address_t, address);
+DO_INIT(HEADER, header);
+void header_wipe(HEADER *);
 
+DO_NEW(HEADER, header);
+DO_DELETE(HEADER, header);
 
 #endif /* MUTT_LIB_MIME_MIME_TYPES_H */