NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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
88 void (*edata_free)(void **ptr);
89
90#ifdef MIXMASTER
91 struct ListHead chain;
92#endif
93#ifdef USE_NOTMUCH
94 void *nm_edata;
95#endif
96
97 // ---------------------------------------------------------------------------
98 // View data - Used by the GUI
99
100 bool attach_del : 1;
101 bool attach_valid : 1;
103 bool matched : 1;
104 bool quasi_deleted : 1;
105 bool recip_valid : 1;
106 bool searched : 1;
108 bool tagged : 1;
109 bool threaded : 1;
110
111 int index;
112 int msgno;
113 const struct AttrColor *attr_color;
114 int score;
115 int vnum;
117 short recipient;
118
119 // The following are used to support collapsing threads
121 bool collapsed : 1;
122 bool visible : 1;
123 bool limit_visited : 1;
124 size_t num_hidden;
126 char *tree;
127};
128ARRAY_HEAD(EmailArray, struct Email *);
129
134{
135 struct Email *email;
137};
138
148{
156};
157
162{
164 struct Email **emails;
165};
166
173{
177};
178
183{
184 char *header;
185};
186
187bool email_cmp_strict(const struct Email *e1, const struct Email *e2);
188void email_free (struct Email **ptr);
189struct Email *email_new (void);
190size_t email_size (const struct Email *e);
191
192struct ListNode *header_add (struct ListHead *hdrlist, const char *header);
193struct ListNode *header_find (const struct ListHead *hdrlist, const char *header);
194void header_free (struct ListHead *hdrlist, struct ListNode *target);
195struct ListNode *header_set (struct ListHead *hdrlist, const char *header);
196struct ListNode *header_update(struct ListNode *hdrnode, const char *header);
197
198#endif /* MUTT_EMAIL_EMAIL_H */
#define ARRAY_HEAD(name, type)
Define a named struct for arrays of elements of a certain type.
Definition: array.h:46
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:173
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:176
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:174
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:175
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
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:148
@ NT_EMAIL_ADD
Email has been added.
Definition: email.h:149
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:150
@ NT_EMAIL_CHANGE_SECURITY
Email's security settings have changed.
Definition: email.h:155
@ NT_EMAIL_DELETE_ALL
All the Emails are about to be deleted.
Definition: email.h:151
@ NT_EMAIL_CHANGE
Email has changed.
Definition: email.h:152
@ NT_EMAIL_CHANGE_ATTACH
Email's Attachments have changed.
Definition: email.h:154
@ NT_EMAIL_CHANGE_ENVELOPE
Email's Envelope has changed.
Definition: email.h:153
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:77
A curses colour and its attributes.
Definition: attr.h:66
The body of an email.
Definition: body.h:36
List of Emails.
Definition: email.h:134
STAILQ_ENTRY(EmailNode) entries
Linked list.
struct Email * email
Email in the list.
Definition: email.h:135
The envelope/body of an email.
Definition: email.h:37
bool searched
Email has been searched.
Definition: email.h:106
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:103
bool display_subject
Used for threading.
Definition: email.h:102
bool visible
Is this message part of the view?
Definition: email.h:122
bool purge
Skip trash folder when deleting.
Definition: email.h:77
bool recip_valid
Is_recipient is valid.
Definition: email.h:105
bool attach_valid
true when the attachment count is valid
Definition: email.h:101
struct Envelope * env
Envelope information.
Definition: email.h:66
bool limit_visited
Has the limit pattern been applied to this message?
Definition: email.h:123
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:121
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:107
bool active
Message is not to be removed.
Definition: email.h:74
void * nm_edata
Notmuch private data.
Definition: email.h:94
char * tree
Character string to print thread tree.
Definition: email.h:126
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:124
void(* edata_free)(void **ptr)
Definition: email.h:88
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:100
bool flagged
Marked important?
Definition: email.h:45
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition: email.h:116
bool threaded
Used for threading.
Definition: email.h:109
struct ListHead chain
Mixmaster chain.
Definition: email.h:91
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition: email.h:113
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:115
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:114
int msgno
Number displayed to the user.
Definition: email.h:112
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:111
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:117
bool quasi_deleted
Deleted from neomutt, but not modified on disk.
Definition: email.h:104
bool tagged
Email is tagged.
Definition: email.h:108
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:120
The header of an Email.
Definition: envelope.h:57
An Event that happened to an Email.
Definition: email.h:162
int num_emails
Number of Emails the event applies to.
Definition: email.h:163
struct Email ** emails
Emails affected by the event.
Definition: email.h:164
An event that happened to a header.
Definition: email.h:183
char * header
The contents of the header.
Definition: email.h:184
A List node for strings.
Definition: list.h:35
An Email conversation.
Definition: thread.h:34
Notification API.
Definition: notify.c:53
Driver based email tags.