1 /** 2 * @file 3 * Representation of the body of an email 4 * 5 * @authors 6 * Copyright (C) 2017 Richard Russon <rich@flatcap.org> 7 * 8 * @copyright 9 * This program is free software: you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License as published by the Free Software 11 * Foundation, either version 2 of the License, or (at your option) any later 12 * version. 13 * 14 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License along with 20 * this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef MUTT_EMAIL_BODY_H 24 #define MUTT_EMAIL_BODY_H 25 26 #include "config.h" 27 #include <stdbool.h> 28 #include <time.h> 29 #include "parameter.h" 30 31 /** 32 * struct Body - The body of an email 33 */ 34 struct Body 35 { 36 // --------------------------------------------------------------------------- 37 // Data that gets stored in the Header Cache 38 39 unsigned int type : 4; ///< content-type primary type, #ContentType 40 unsigned int encoding : 3; ///< content-transfer-encoding, #ContentEncoding 41 unsigned int disposition : 2; ///< content-disposition, #ContentDisposition 42 bool badsig : 1; ///< Bad cryptographic signature (needed to check encrypted s/mime-signatures) 43 bool force_charset : 1; ///< Send mode: don't adjust the character set when in send-mode. 44 bool goodsig : 1; ///< Good cryptographic signature 45 bool noconv : 1; ///< Don't do character set conversion 46 bool use_disp : 1; ///< Content-Disposition uses filename= ? 47 bool warnsig : 1; ///< Maybe good signature 48 #ifdef USE_AUTOCRYPT 49 bool is_autocrypt : 1; ///< Flag autocrypt-decrypted messages for replying 50 #endif 51 LOFF_T offset; ///< offset where the actual data begins 52 LOFF_T length; ///< length (in bytes) of attachment 53 54 char *description; ///< content-description 55 char *d_filename; ///< filename to be used for the content-disposition header 56 ///< If NULL, filename is used instead. 57 char *filename; ///< When sending a message, this is the file to which this structure refers 58 char *form_name; ///< Content-Disposition form-data name param 59 char *subtype; ///< content-type subtype 60 char *xtype; ///< content-type if x-unknown 61 struct ParameterList parameter; ///< Parameters of the content-type 62 63 // --------------------------------------------------------------------------- 64 // Management data - Runtime info and glue to hold the objects together 65 66 bool unlink : 1; ///< If true, `filename` should be unlink()ed before free()ing this structure 67 68 struct Content *content; ///< Detailed info about the content of the attachment. 69 ///< Used to determine what content-transfer-encoding is required when sending mail. 70 struct Body *next; ///< next attachment in the list 71 struct Body *parts; ///< parts of a multipart or message/rfc822 72 struct Email *email; ///< header information for message/rfc822 73 struct AttachPtr *aptr; ///< Menu information, used in recvattach.c 74 struct Envelope *mime_headers; ///< Memory hole protected headers 75 time_t stamp; ///< Time stamp of last encoding update 76 char *language; ///< content-language (RFC8255) 77 char *charset; ///< Send mode: charset of attached file as stored on disk. 78 ///< The charset used in the generated message is stored in parameter. 79 long hdr_offset; ///< Offset in stream where the headers begin. 80 ///< This info is used when invoking metamail, where we need to send the headers of the attachment 81 82 // --------------------------------------------------------------------------- 83 // View data - Used by the GUI 84 85 bool attach_qualifies : 1; ///< This attachment should be counted 86 bool collapsed : 1; ///< Used by recvattach 87 bool deleted : 1; ///< Attachment marked for deletion 88 bool nowrap : 1; ///< Do not wrap the output in the pager 89 bool tagged : 1; ///< This attachment is tagged 90 signed short attach_count; ///< Number of attachments 91 }; 92 93 bool mutt_body_cmp_strict(const struct Body *b1, const struct Body *b2); 94 void mutt_body_free (struct Body **ptr); 95 char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen); 96 struct Body *mutt_body_new (void); 97 98 #endif /* MUTT_EMAIL_BODY_H */ 99