X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mime%2Fmime-types.h;h=179e7b29afe006f93c24276b0f0fc62917f03464;hp=9d4d70e9efb8ecc0c54db570e4dff3fb08d9f7a7;hb=refs%2Fheads%2Ftry-some-d;hpb=a5074c20c3873e4a1fbfea551b07bd1c867a9def diff --git a/lib-mime/mime-types.h b/lib-mime/mime-types.h index 9d4d70e..179e7b2 100644 --- a/lib-mime/mime-types.h +++ b/lib-mime/mime-types.h @@ -30,13 +30,7 @@ #ifndef MUTT_LIB_MIME_MIME_TYPES_H #define MUTT_LIB_MIME_MIME_TYPES_H -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include +#include /* Content-Type */ enum { @@ -60,7 +54,7 @@ enum { ENCQUOTEDPRINTABLE, ENCBASE64, ENCBINARY, - ENCUUENCODED + ENCUUENCODED, }; /* Content-Disposition values */ @@ -75,30 +69,40 @@ enum { /****************************************************************************/ typedef struct address_t { + struct address_t *next; char *personal; /* real name of address */ char *mailbox; /* mailbox and host address */ int group; /* group mailbox? */ - struct address_t *next; } address_t; DO_INIT(address_t, address); -void address_wipe(address_t *); +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); - +DO_SLIST(address_t, address, address_delete); /****************************************************************************/ /* rfc822 header parameters */ /****************************************************************************/ -typedef struct parameter { - char *attribute; - char *value; - struct parameter *next; -} PARAMETER; +typedef struct parameters_t parameters_t; +parameters_t *parameter_new(); +parameters_t *parameter_dup(parameters_t *); +char *parameter_getval(parameters_t *, const char *); +void parameter_setval(parameters_t *, const char *, const char *); +void parameter_delval(parameters_t * p, const char *); +void parameter_set_boundary(parameters_t *); +void parameter_purge_empty(parameters_t *); + +int parameter_equal(const parameters_t *, const parameters_t *); + +void parameter_foreach(const parameters_t *, + void (*f)(const char *, const char *)); /****************************************************************************/ /* rfc822 envelopes */ @@ -121,20 +125,19 @@ typedef struct envelope_t { char *date; char *x_label; char *organization; -#ifdef USE_NNTP - char *newsgroups; - char *xref; - char *followup_to; - 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-* */ @@ -160,9 +163,11 @@ typedef struct content { /****************************************************************************/ typedef struct body { + struct body *next; /* next attachment in the list */ + char *xtype; /* content-type if x-unknown */ char *subtype; /* content-type subtype */ - PARAMETER *parameter; /* parameters of the content-type */ + parameters_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. @@ -186,7 +191,6 @@ typedef struct body { * 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 */ @@ -230,6 +234,17 @@ typedef struct body { unsigned int attach_qualifies:1; } 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 */ @@ -294,23 +309,22 @@ see: crypt.h pgplib.h, smime.h */ ENVELOPE *env; /* envelope information */ BODY *content; /* list of MIME parts */ char *path; -#ifdef USE_NNTP - int article_num; -#endif char *tree; /* character string to print thread tree */ struct thread *thread; 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; +DO_INIT(HEADER, header); +void header_wipe(HEADER *); + +DO_NEW(HEADER, header); +DO_DELETE(HEADER, header); + #endif /* MUTT_LIB_MIME_MIME_TYPES_H */