NeoMutt  2022-04-29-81-g9c5a59
Teaching an old dog new tricks
Go to the documentation of this file.
26 #include "config.h"
27 #include <stdbool.h>
28 #include <time.h>
29 #include "mutt/lib.h"
30 #include "ncrypt/lib.h"
31 #include "tags.h"
36 struct Email
37 {
38  // ---------------------------------------------------------------------------
39  // Data that gets stored in the Header Cache
44  bool expired : 1;
45  bool flagged : 1;
46  bool mime : 1;
47  bool old : 1;
48  bool read : 1;
49  bool replied : 1;
50  bool superseded : 1;
51  bool trash : 1;
53  // Timezone of the sender of this message
54  unsigned int zhours : 5;
55  unsigned int zminutes : 6;
56  bool zoccident : 1;
58  time_t date_sent;
59  time_t received;
60  int lines;
62  // ---------------------------------------------------------------------------
63  // Management data - Runtime info and glue to hold the objects together
65  size_t sequence;
66  struct Envelope *env;
67  struct Body *body;
68  char *path;
69  LOFF_T offset;
70  struct TagList tags;
71  struct Notify *notify;
72  void *edata;
74  bool active : 1;
75  bool changed : 1;
76  bool deleted : 1;
77  bool purge : 1;
87  void (*edata_free)(void **ptr);
89 #ifdef MIXMASTER
90  struct ListHead chain;
91 #endif
92 #ifdef USE_NOTMUCH
93  void *nm_edata;
94 #endif
96  // ---------------------------------------------------------------------------
97  // View data - Used by the GUI
99  bool attach_del : 1;
100  bool attach_valid : 1;
101  bool display_subject : 1;
102  bool matched : 1;
103  bool quasi_deleted : 1;
104  bool recip_valid : 1;
105  bool searched : 1;
106  bool subject_changed : 1;
107  bool tagged : 1;
108  bool threaded : 1;
110  int index;
111  int msgno;
113  int score;
114  int vnum;
115  short attach_total;
116  short recipient;
118  // The following are used to support collapsing threads
119  struct MuttThread *thread;
120  bool collapsed : 1;
121  bool visible : 1;
122  size_t num_hidden;
124  char *tree;
125 };
130 struct EmailNode
131 {
132  struct Email *email;
134 };
135 STAILQ_HEAD(EmailList, EmailNode);
146 {
154 };
160 {
162  struct Email **emails;
163 };
171 {
175 };
181 {
182  char *header;
183 };
185 bool email_cmp_strict(const struct Email *e1, const struct Email *e2);
186 void email_free (struct Email **ptr);
187 struct Email *email_new (void);
188 size_t email_size (const struct Email *e);
190 int emaillist_add_email(struct EmailList *el, struct Email *e);
191 void emaillist_clear (struct EmailList *el);
193 struct ListNode *header_add (struct ListHead *hdrlist, const char *header);
194 struct ListNode *header_find (const struct ListHead *hdrlist, const char *header);
195 void header_free (struct ListHead *hdrlist, struct ListNode *target);
196 struct ListNode *header_set (struct ListHead *hdrlist, const char *header);
197 struct ListNode *header_update(struct ListNode *hdrnode, const char *header);
199 #endif /* MUTT_EMAIL_EMAIL_H */
int emaillist_add_email(struct EmailList *el, struct Email *e)
Add an Email to a list.
Definition: email.c:159
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:203
STAILQ_HEAD(EmailList, EmailNode)
Types of Header Event.
Definition: email.h:171
An existing header has been changed.
Definition: email.h:174
Header has been added.
Definition: email.h:172
Header has been removed.
Definition: email.h:173
bool email_cmp_strict(const struct Email *e1, const struct Email *e2)
Strictly compare message emails.
Definition: email.c:100
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:233
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:245
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition: email.c:180
struct Email * email_new(void)
Create a new Email.
Definition: email.c:78
struct ListNode * header_update(struct ListNode *hdrnode, const char *header)
Update an existing header.
Definition: email.c:217
size_t email_size(const struct Email *e)
Compute the size of an email.
Definition: email.c:125
Types of Email Event.
Definition: email.h:146
Email has been added.
Definition: email.h:147
Email is about to be deleted.
Definition: email.h:148
Email's security settings have changed.
Definition: email.h:153
All the Emails are about to be deleted.
Definition: email.h:149
Email has changed.
Definition: email.h:150
Email's Attachments have changed.
Definition: email.h:152
Email's Envelope has changed.
Definition: email.h:151
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:44
void emaillist_clear(struct EmailList *el)
Drop a private list of Emails.
Definition: email.c:138
Convenience wrapper for the library headers.
API for encryption/signing of emails.
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: lib.h:74
A curses colour and its attributes.
Definition: attr.h:35
The body of an email.
Definition: body.h:36
List of Emails.
Definition: email.h:131
STAILQ_ENTRY(EmailNode) entries
Linked list.
struct Email * email
Email in the list.
Definition: email.h:132
The envelope/body of an email.
Definition: email.h:37
bool searched
Email has been searched.
Definition: email.h:105
bool read
Email is read.
Definition: email.h:48
unsigned int zminutes
Minutes away from UTC.
Definition: email.h:55
bool matched
Search matches this Email.
Definition: email.h:102
bool display_subject
Used for threading.
Definition: email.h:101
bool visible
Is this message part of the view?
Definition: email.h:121
bool purge
Skip trash folder when deleting.
Definition: email.h:77
bool recip_valid
Is_recipient is valid.
Definition: email.h:104
bool attach_valid
true when the attachment count is valid
Definition: email.h:100
struct Envelope * env
Envelope information.
Definition: email.h:66
bool mime
Has a MIME-Version header?
Definition: email.h:46
void * edata
Driver-specific data.
Definition: email.h:72
bool collapsed
Is this message part of a collapsed thread?
Definition: email.h:120
int lines
How many lines in the body of this message?
Definition: email.h:60
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:41
struct Body * body
List of MIME parts.
Definition: email.h:67
bool subject_changed
Used for threading.
Definition: email.h:106
bool active
Message is not to be removed.
Definition: email.h:74
void * nm_edata
Notmuch private data.
Definition: email.h:93
char * tree
Character string to print thread tree.
Definition: email.h:124
bool old
Email is seen, but unread.
Definition: email.h:47
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
Definition: email.h:122
struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition: email.h:112
void(* edata_free)(void **ptr)
Free the private data attached to the Email.
Definition: email.h:87
bool zoccident
True, if west of UTC, False if east.
Definition: email.h:56
bool changed
Email has been edited.
Definition: email.h:75
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:69
bool attach_del
Has an attachment marked for deletion.
Definition: email.h:99
bool flagged
Marked important?
Definition: email.h:45
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition: email.h:115
bool threaded
Used for threading.
Definition: email.h:108
struct ListHead chain
Mixmaster chain.
Definition: email.h:90
unsigned int zhours
Hours away from UTC.
Definition: email.h:54
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:58
bool replied
Email has been replied to.
Definition: email.h:49
int vnum
Virtual message number.
Definition: email.h:114
bool expired
Already expired?
Definition: email.h:44
struct TagList tags
For drivers that support server tagging.
Definition: email.h:70
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition: email.h:71
int score
Message score.
Definition: email.h:113
int msgno
Number displayed to the user.
Definition: email.h:111
char * path
Path of Email (for local Mailboxes)
Definition: email.h:68
size_t sequence
Sequence number assigned on creation.
Definition: email.h:65
bool deleted
Email is deleted.
Definition: email.h:76
int index
The absolute (unsorted) message number.
Definition: email.h:110
bool trash
Message is marked as trashed on disk (used by the maildir_trash option)
Definition: email.h:51
short recipient
User_is_recipient()'s return value, cached.
Definition: email.h:116
bool quasi_deleted
Deleted from neomutt, but not modified on disk.
Definition: email.h:103
bool tagged
Email is tagged.
Definition: email.h:107
bool superseded
Got superseded?
Definition: email.h:50
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:59
struct MuttThread * thread
Thread of Emails.
Definition: email.h:119
The header of an Email.
Definition: envelope.h:57
An Event that happened to an Email.
Definition: email.h:160
int num_emails
Number of Emails the event applies to.
Definition: email.h:161
struct Email ** emails
Emails affected by the event.
Definition: email.h:162
An event that happened to a header.
Definition: email.h:181
char * header
The contents of the header.
Definition: email.h:182
A List node for strings.
Definition: list.h:35
An Email conversation.
Definition: thread.h:35
Notification API.
Definition: notify.c:51
Driver based email tags.