1 /** 2 * @file 3 * Representation of an email header (envelope) 4 * 5 * @authors 6 * Copyright (C) 2017 Richard Russon <rich@flatcap.org> 7 * Copyright (C) 2019 Pietro Cerutti <gahr@gahr.ch> 8 * 9 * @copyright 10 * This program is free software: you can redistribute it and/or modify it under 11 * the terms of the GNU General Public License as published by the Free Software 12 * Foundation, either version 2 of the License, or (at your option) any later 13 * version. 14 * 15 * This program is distributed in the hope that it will be useful, but WITHOUT 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 * details. 19 * 20 * You should have received a copy of the GNU General Public License along with 21 * this program. If not, see <http://www.gnu.org/licenses/>. 22 */ 23 24 #ifndef MUTT_EMAIL_ENVELOPE_H 25 #define MUTT_EMAIL_ENVELOPE_H 26 27 #include "config.h" 28 #include <stdbool.h> 29 #include "mutt/lib.h" 30 #include "address/lib.h" 31 32 #define MUTT_ENV_CHANGED_IRT (1 << 0) ///< In-Reply-To changed to link/break threads 33 #define MUTT_ENV_CHANGED_REFS (1 << 1) ///< References changed to break thread 34 #define MUTT_ENV_CHANGED_XLABEL (1 << 2) ///< X-Label edited 35 #define MUTT_ENV_CHANGED_SUBJECT (1 << 3) ///< Protected header update 36 37 #ifdef USE_AUTOCRYPT 38 /** 39 * struct AutocryptHeader - Parse Autocrypt header info 40 */ 41 struct AutocryptHeader 42 { 43 char *addr; ///< Email address 44 char *keydata; ///< PGP Key data 45 bool prefer_encrypt : 1; ///< User prefers encryption 46 bool invalid : 1; ///< Header is invalid 47 struct AutocryptHeader *next; ///< Linked list 48 }; 49 #endif 50 51 /** 52 * struct Envelope - The header of an Email 53 */ 54 struct Envelope 55 { 56 struct AddressList return_path; ///< Return path for the Email 57 struct AddressList from; ///< Email's 'From' list 58 struct AddressList to; ///< Email's 'To' list 59 struct AddressList cc; ///< Email's 'Cc' list 60 struct AddressList bcc; ///< Email's 'Bcc' list 61 struct AddressList sender; ///< Email's sender 62 struct AddressList reply_to; ///< Email's 'reply-to' 63 struct AddressList mail_followup_to; ///< Email's 'mail-followup-to' 64 struct AddressList x_original_to; ///< Email's 'X-Orig-to' 65 char *list_post; ///< This stores a mailto URL, or nothing 66 char *list_subscribe; ///< This stores a mailto URL, or nothing 67 char *list_unsubscribe; ///< This stores a mailto URL, or nothing 68 char *subject; ///< Email's subject 69 char *real_subj; ///< Offset of the real subject 70 char *disp_subj; ///< Display subject (modified copy of subject) 71 char *message_id; ///< Message ID 72 char *supersedes; ///< Supersedes header 73 char *date; ///< Sent date 74 char *x_label; ///< X-Label 75 char *organization; ///< Organisation header 76 #ifdef USE_NNTP 77 char *newsgroups; ///< List of newsgroups 78 char *xref; ///< List of cross-references 79 char *followup_to; ///< List of 'followup-to' fields 80 char *x_comment_to; ///< List of 'X-comment-to' fields 81 #endif 82 struct Buffer spam; ///< Spam header 83 struct ListHead references; ///< message references (in reverse order) 84 struct ListHead in_reply_to; ///< in-reply-to header content 85 struct ListHead userhdrs; ///< user defined headers 86 #ifdef USE_AUTOCRYPT 87 struct AutocryptHeader *autocrypt; ///< Autocrypt header 88 struct AutocryptHeader *autocrypt_gossip; ///< Autocrypt Gossip header 89 #endif 90 unsigned char changed; ///< Changed fields, e.g. #MUTT_ENV_CHANGED_SUBJECT 91 }; 92 93 bool mutt_env_cmp_strict(const struct Envelope *e1, const struct Envelope *e2); 94 void mutt_env_free (struct Envelope **ptr); 95 void mutt_env_merge (struct Envelope *base, struct Envelope **extra); 96 struct Envelope *mutt_env_new (void); 97 int mutt_env_to_intl (struct Envelope *env, const char **tag, char **err); 98 void mutt_env_to_local (struct Envelope *e); 99 100 #ifdef USE_AUTOCRYPT 101 struct AutocryptHeader *mutt_autocrypthdr_new(void); 102 void mutt_autocrypthdr_free(struct AutocryptHeader **p); 103 #endif 104 105 #endif /* MUTT_EMAIL_ENVELOPE_H */ 106