Remove the time module alltogether.
[apps/madmutt.git] / lib-mime / mime-types.h
index 3744cbc..c57c90e 100644 (file)
 #ifndef MUTT_LIB_MIME_MIME_TYPES_H
 #define MUTT_LIB_MIME_MIME_TYPES_H
 
 #ifndef MUTT_LIB_MIME_MIME_TYPES_H
 #define MUTT_LIB_MIME_MIME_TYPES_H
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <lib-lib/mem.h>
-#include <lib-lib/buffer.h>
-#include <lib-lib/list.h>
+#include <lib-lib/lib-lib.h>
 
 /* Content-Type */
 enum {
 
 /* Content-Type */
 enum {
@@ -60,7 +54,7 @@ enum {
     ENCQUOTEDPRINTABLE,
     ENCBASE64,
     ENCBINARY,
     ENCQUOTEDPRINTABLE,
     ENCBASE64,
     ENCBINARY,
-    ENCUUENCODED
+    ENCUUENCODED,
 };
 
 /* Content-Disposition values */
 };
 
 /* Content-Disposition values */
@@ -70,19 +64,58 @@ enum {
     DISPFORMDATA
 };
 
     DISPFORMDATA
 };
 
-typedef struct parameter {
-    char *attribute;
-    char *value;
-    struct parameter *next;
-} PARAMETER;
+/****************************************************************************/
+/* rfc822 addresses                                                         */
+/****************************************************************************/
 
 typedef struct address_t {
 
 typedef struct address_t {
+    struct address_t *next;
     char *personal;               /* real name of address */
     char *mailbox;                /* mailbox and host address */
     int group;                    /* group mailbox? */
     char *personal;               /* real name of address */
     char *mailbox;                /* mailbox and host address */
     int group;                    /* group mailbox? */
-    struct address_t *next;
 } address_t;
 
 } 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_t {
+    struct parameter_t *next;
+    char *attribute;
+    char *value;
+} parameter_t;
+
+DO_INIT(parameter_t, parameter);
+static inline void parameter_wipe(parameter_t *param) {
+    p_delete(&param->attribute);
+    p_delete(&param->value);
+}
+
+DO_NEW(parameter_t, parameter);
+DO_DELETE(parameter_t, parameter);
+DO_SLIST(parameter_t, parameter, parameter_delete);
+
+char *parameter_getval(parameter_t *, const char *);
+void parameter_setval(parameter_t **, const char *, const char *);
+void parameter_delval(parameter_t ** p, const char *);
+void parameter_set_boundary(parameter_t **);
+
+int parameter_equal(const parameter_t *, const parameter_t *);
+
+/****************************************************************************/
+/* rfc822 envelopes                                                         */
+/****************************************************************************/
+
 typedef struct envelope_t {
     address_t *return_path;
     address_t *from;
 typedef struct envelope_t {
     address_t *return_path;
     address_t *from;
@@ -104,16 +137,25 @@ typedef struct envelope_t {
     char *newsgroups;
     char *xref;
     char *followup_to;
     char *newsgroups;
     char *xref;
     char *followup_to;
-    char *x_comment_to;
 #endif
     BUFFER *spam;
 #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;
 
     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 */
 /* Information that helps in determing the Content-* of an attachment */
 typedef struct content {
     long hibin;                   /* 8-bit characters */
@@ -128,10 +170,17 @@ typedef struct content {
     unsigned int cr:1;            /* has CR, even when in a CRLF pair */
 } CONTENT;
 
     unsigned int cr:1;            /* has CR, even when in a CRLF pair */
 } CONTENT;
 
+
+/****************************************************************************/
+/* rfc822 Bodies                                                            */
+/****************************************************************************/
+
 typedef struct body {
 typedef struct body {
+    struct body *next;            /* next attachment in the list */
+
     char *xtype;                  /* content-type if x-unknown */
     char *subtype;                /* content-type subtype */
     char *xtype;                  /* content-type if x-unknown */
     char *subtype;                /* content-type subtype */
-    PARAMETER *parameter;         /* parameters of the content-type */
+    parameter_t *parameter;         /* parameters of the content-type */
     char *description;            /* content-description */
     char *form_name;              /* Content-Disposition form-data name param */
     off_t hdr_offset;             /* offset in stream where the headers begin.
     char *description;            /* content-description */
     char *form_name;              /* Content-Disposition form-data name param */
     off_t hdr_offset;             /* offset in stream where the headers begin.
@@ -155,7 +204,6 @@ typedef struct body {
                                    * to determine what content-transfer-encoding
                                    * is required when sending mail.
                                    */
                                    * to determine what content-transfer-encoding
                                    * is required when sending mail.
                                    */
-    struct body *next;            /* next attachment in the list */
     struct body *parts;           /* parts of a multipart or message/rfc822 */
     struct header *hdr;           /* header information for message/rfc822 */
 
     struct body *parts;           /* parts of a multipart or message/rfc822 */
     struct header *hdr;           /* header information for message/rfc822 */
 
@@ -197,9 +245,24 @@ typedef struct body {
 
     unsigned int collapsed:1;     /* used by recvattach */
     unsigned int attach_qualifies:1;
 
     unsigned int collapsed:1;     /* used by recvattach */
     unsigned int attach_qualifies:1;
-
 } BODY;
 
 } BODY;
 
+static inline BODY *body_init(BODY *b) {
+    b->disposition = DISPATTACH;
+    b->use_disp = 1;
+    return b;
+}
+void body_wipe(BODY *);
+
+DO_NEW(BODY, body);
+DO_DELETE(BODY, body);
+DO_SLIST(BODY, body, body_delete);
+
+
+/****************************************************************************/
+/* rfc822 Headers                                                           */
+/****************************************************************************/
+
 typedef struct header {
     unsigned int security:11;     /* bit 0-6: flags, bit 7,8: application.
 see: crypt.h pgplib.h, smime.h */
 typedef struct header {
     unsigned int security:11;     /* bit 0-6: flags, bit 7,8: application.
 see: crypt.h pgplib.h, smime.h */
@@ -268,22 +331,16 @@ see: crypt.h pgplib.h, smime.h */
 
     short attach_total;
 
 
     short attach_total;
 
-#ifdef MIXMASTER
-    LIST *chain;
-#endif
-
     int refno;                    /* message number on server */
     void *data;                   /* driver-specific data */
 
     char *maildir_flags;          /* unknown maildir flags */
 } HEADER;
 
     int refno;                    /* message number on server */
     void *data;                   /* driver-specific data */
 
     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 */
 
 #endif /* MUTT_LIB_MIME_MIME_TYPES_H */