NeoMutt  2023-05-17-56-ga67199
Teaching an old dog new tricks
DOXYGEN
email.h
Go to the documentation of this file.
1
23#ifndef MUTT_EMAIL_EMAIL_H
24#define MUTT_EMAIL_EMAIL_H
25
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"
32
36struct Email
37{
38 // ---------------------------------------------------------------------------
39 // Data that gets stored in the Header Cache
40
43
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;
52
53 // Timezone of the sender of this message
54 unsigned int zhours : 5;
55 unsigned int zminutes : 6;
56 bool zoccident : 1;
57
58 time_t date_sent;
59 time_t received;
60 int lines;
61
62 // ---------------------------------------------------------------------------
63 // Management data - Runtime info and glue to hold the objects together
64
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;
73
74 bool active : 1;
75 bool changed : 1;
76 bool deleted : 1;
77 bool purge : 1;
78
86 void (*edata_free)(void **ptr);
87
88#ifdef MIXMASTER
89 struct ListHead chain;
90#endif
91#ifdef USE_NOTMUCH
92 void *nm_edata;
93#endif
94
95 // ---------------------------------------------------------------------------
96 // View data - Used by the GUI
97
98 bool attach_del : 1;
99 bool attach_valid : 1;
101 bool matched : 1;
102 bool quasi_deleted : 1;
103 bool recip_valid : 1;
104 bool searched : 1;
106 bool tagged : 1;
107 bool threaded : 1;
108
109 int index;
110 int msgno;
112 int score;
113 int vnum;
115 short recipient;
116
117 // The following are used to support collapsing threads
119 bool collapsed : 1;
120 bool visible : 1;
121 bool limit_visited : 1;
122 size_t num_hidden;
124 char *tree;
125};
126ARRAY_HEAD(EmailArray, struct Email *);
127
132{
133 struct Email *email;
135};
136
146{
154};
155
160{
162 struct Email **emails;
163};
164
171{
175};
176
181{
182 char *header;
183};
184
185bool email_cmp_strict(const struct Email *e1, const struct Email *e2);
186void email_free (struct Email **ptr);
187struct Email *email_new (void);
188size_t email_size (const struct Email *e);
189
190struct ListNode *header_add (struct ListHead *hdrlist, const char *header);
191struct ListNode *header_find (const struct ListHead *hdrlist, const char *header);
192void header_free (struct ListHead *hdrlist, struct ListNode *target);
193struct ListNode *header_set (struct ListHead *hdrlist, const char *header);
194struct ListNode *header_update(struct ListNode *hdrnode, const char *header);
195
196#endif /* MUTT_EMAIL_EMAIL_H */
struct ListNode * header_update(struct ListNode *hdrnode, const char *header)
Update an existing header.
Definition: email.c:178
NotifyHeader
Types of Header Event.
Definition: email.h:171
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:174
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:172
@ NT_HEADER_DELETE
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
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:206
ARRAY_HEAD(EmailArray, struct Email *)
size_t email_size(const struct Email *e)
Compute the size of an email.
Definition: email.c:125
struct Email * email_new(void)
Create a new Email.
Definition: email.c:78
NotifyEmail
Types of Email Event.
Definition: email.h:146
@ NT_EMAIL_ADD
Email has been added.
Definition: email.h:147
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:148
@ NT_EMAIL_CHANGE_SECURITY
Email's security settings have changed.
Definition: email.h:153
@ NT_EMAIL_DELETE_ALL
All the Emails are about to be deleted.
Definition: email.h:149
@ NT_EMAIL_CHANGE
Email has changed.
Definition: email.h:150
@ NT_EMAIL_CHANGE_ATTACH
Email's Attachments have changed.
Definition: email.h:152
@ NT_EMAIL_CHANGE_ENVELOPE
Email's Envelope has changed.
Definition: email.h:151
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:194
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:164
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:44
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:141
Convenience wrapper for the library headers.
API for encryption/signing of emails.
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: lib.h:76
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:132
STAILQ_ENTRY(EmailNode) entries
Linked list.
struct Email * email
Email in the list.
Definition: email.h:133
The envelope/body of an email.
Definition: email.h:37
bool searched
Email has been searched.
Definition: email.h:104
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:101
bool display_subject
Used for threading.
Definition: email.h:100
bool visible
Is this message part of the view?
Definition: email.h:120
bool purge
Skip trash folder when deleting.
Definition: email.h:77
bool recip_valid
Is_recipient is valid.
Definition: email.h:103
bool attach_valid
true when the attachment count is valid
Definition: email.h:99
struct Envelope * env
Envelope information.
Definition: email.h:66
bool limit_visited
Has the limit pattern been applied to this message?
Definition: email.h:121
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:119
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:105
bool active
Message is not to be removed.
Definition: email.h:74
void * nm_edata
Notmuch private data.
Definition: email.h:92
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:111
void(* edata_free)(void **ptr)
Free the private data attached to the Email.
Definition: email.h:86
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:98
bool flagged
Marked important?
Definition: email.h:45
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition: email.h:114
bool threaded
Used for threading.
Definition: email.h:107
struct ListHead chain
Mixmaster chain.
Definition: email.h:89
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:113
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:112
int msgno
Number displayed to the user.
Definition: email.h:110
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:109
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:115
bool quasi_deleted
Deleted from neomutt, but not modified on disk.
Definition: email.h:102
bool tagged
Email is tagged.
Definition: email.h:106
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:118
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:34
Notification API.
Definition: notify.c:51
Driver based email tags.