NeoMutt  2024-04-25-91-gb0e085
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
email.h
Go to the documentation of this file.
1
25#ifndef MUTT_EMAIL_EMAIL_H
26#define MUTT_EMAIL_EMAIL_H
27
28#include "config.h"
29#include <stdbool.h>
30#include <time.h>
31#include "mutt/lib.h"
32#include "ncrypt/lib.h"
33#include "tags.h"
34
38struct Email
39{
40 // ---------------------------------------------------------------------------
41 // Data that gets stored in the Header Cache
42
45
46 bool expired : 1;
47 bool flagged : 1;
48 bool mime : 1;
49 bool old : 1;
50 bool read : 1;
51 bool replied : 1;
52 bool superseded : 1;
53 bool trash : 1;
54
55 // Timezone of the sender of this message
56 unsigned int zhours : 5;
57 unsigned int zminutes : 6;
58 bool zoccident : 1;
59
60 time_t date_sent;
61 time_t received;
62 int lines;
63
64 // ---------------------------------------------------------------------------
65 // Management data - Runtime info and glue to hold the objects together
66
67 size_t sequence;
68 struct Envelope *env;
69 struct Body *body;
70 char *path;
71 LOFF_T offset;
72 struct TagList tags;
73 struct Notify *notify;
74 void *edata;
75
76 bool active : 1;
77 bool changed : 1;
78 bool deleted : 1;
79 bool purge : 1;
80
90 void (*edata_free)(void **ptr);
91
92#ifdef USE_NOTMUCH
93 void *nm_edata;
94#endif
95
96 // ---------------------------------------------------------------------------
97 // View data - Used by the GUI
98
99 bool attach_del : 1;
100 bool attach_valid : 1;
102 bool matched : 1;
103 bool quasi_deleted : 1;
104 bool recip_valid : 1;
105 bool searched : 1;
107 bool tagged : 1;
108 bool threaded : 1;
109
110 int index;
111 int msgno;
112 const struct AttrColor *attr_color;
113 int score;
114 int vnum;
116 short recipient;
117
118 // The following are used to support collapsing threads
120 bool collapsed : 1;
121 bool visible : 1;
122 bool limit_visited : 1;
123 size_t num_hidden;
125 char *tree;
126};
127ARRAY_HEAD(EmailArray, struct Email *);
128
135{
162};
163
168{
169 struct Email *email;
171};
172
182{
190};
191
196{
198 struct Email **emails;
199};
200
207{
211};
212
217{
218 char *header;
219};
220
221bool email_cmp_strict(const struct Email *e1, const struct Email *e2);
222void email_free (struct Email **ptr);
223struct Email *email_new (void);
224size_t email_size (const struct Email *e);
225
226struct ListNode *header_add (struct ListHead *hdrlist, const char *header);
227struct ListNode *header_find (const struct ListHead *hdrlist, const char *header);
228void header_free (struct ListHead *hdrlist, struct ListNode *target);
229struct ListNode *header_set (struct ListHead *hdrlist, const char *header);
230struct ListNode *header_update(struct ListNode *hdrnode, const char *header);
231
232#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:47
struct ListNode * header_update(struct ListNode *hdrnode, const char *header)
Update an existing header.
Definition: email.c:174
NotifyHeader
Types of Header Event.
Definition: email.h:207
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:210
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:208
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:209
bool email_cmp_strict(const struct Email *e1, const struct Email *e2)
Strictly compare message emails.
Definition: email.c:96
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:202
ExpandoDataEmail
Expando UIDs for Emails.
Definition: email.h:135
@ ED_EMA_ATTACHMENT_COUNT
Email, mutt_count_body_parts()
Definition: email.h:136
@ ED_EMA_DATE_FORMAT_LOCAL
Email.date_sent.
Definition: email.h:141
@ ED_EMA_TAGS_TRANSFORMED
Email.tags, driver_tags_get_transformed()
Definition: email.h:156
@ ED_EMA_THREAD_HIDDEN_COUNT
Email.collapsed, Email.num_hidden, ...
Definition: email.h:158
@ ED_EMA_DATE_FORMAT
Email.date_sent.
Definition: email.h:140
@ ED_EMA_THREAD_TAGS
Email.tags.
Definition: email.h:160
@ ED_EMA_TAGS
Email.tags.
Definition: email.h:155
@ ED_EMA_SIZE
Body.length.
Definition: email.h:150
@ ED_EMA_FLAG_CHARS
Email.deleted, Email.attach_del, ...
Definition: email.h:142
@ ED_EMA_THREAD_NUMBER
Email, mutt_messages_in_thread()
Definition: email.h:159
@ ED_EMA_TO_CHARS
Email, User_is_recipient()
Definition: email.h:161
@ ED_EMA_BODY_CHARACTERS
Body.length.
Definition: email.h:137
@ ED_EMA_STRF
Email.date_sent, Email.zhours, Email.zminutes, Email.zoccident.
Definition: email.h:152
@ ED_EMA_COMBINED_FLAGS
Email.read, Email.old, thread_is_new(), ...
Definition: email.h:138
@ ED_EMA_THREAD_COUNT
Email, mutt_messages_in_thread()
Definition: email.h:157
@ ED_EMA_STATUS_FLAGS
Email.deleted, Email.attach_del, ...
Definition: email.h:151
@ ED_EMA_NUMBER
Email.msgno.
Definition: email.h:148
@ ED_EMA_FROM_LIST
Envelope.to, Envelope.cc.
Definition: email.h:143
@ ED_EMA_SCORE
Email.score.
Definition: email.h:149
@ ED_EMA_CRYPTO_FLAGS
Email.security, SecurityFlags.
Definition: email.h:139
@ ED_EMA_STRF_RECV_LOCAL
Email.received.
Definition: email.h:154
@ ED_EMA_STRF_LOCAL
Email.date_sent.
Definition: email.h:153
@ ED_EMA_LIST_OR_SAVE_FOLDER
Envelope.to, Envelope.cc, check_for_mailing_list()
Definition: email.h:146
@ ED_EMA_INDEX_HOOK
Mailbox, Email, mutt_idxfmt_hook()
Definition: email.h:144
@ ED_EMA_LINES
Email.lines.
Definition: email.h:145
@ ED_EMA_MESSAGE_FLAGS
Email.tagged, Email.flagged.
Definition: email.h:147
size_t email_size(const struct Email *e)
Compute the size of an email.
Definition: email.c:121
struct Email * email_new(void)
Create a new Email.
Definition: email.c:77
NotifyEmail
Types of Email Event.
Definition: email.h:182
@ NT_EMAIL_ADD
Email has been added.
Definition: email.h:183
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:184
@ NT_EMAIL_CHANGE_SECURITY
Email's security settings have changed.
Definition: email.h:189
@ NT_EMAIL_DELETE_ALL
All the Emails are about to be deleted.
Definition: email.h:185
@ NT_EMAIL_CHANGE
Email has changed.
Definition: email.h:186
@ NT_EMAIL_CHANGE_ATTACH
Email's Attachments have changed.
Definition: email.h:188
@ NT_EMAIL_CHANGE_ENVELOPE
Email's Envelope has changed.
Definition: email.h:187
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:190
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:160
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:46
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:137
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:66
The body of an email.
Definition: body.h:36
List of Emails.
Definition: email.h:168
STAILQ_ENTRY(EmailNode) entries
Linked list.
struct Email * email
Email in the list.
Definition: email.h:169
The envelope/body of an email.
Definition: email.h:39
bool searched
Email has been searched.
Definition: email.h:105
bool read
Email is read.
Definition: email.h:50
unsigned int zminutes
Minutes away from UTC.
Definition: email.h:57
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:79
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:68
bool limit_visited
Has the limit pattern been applied to this message?
Definition: email.h:122
bool mime
Has a MIME-Version header?
Definition: email.h:48
void * edata
Driver-specific data.
Definition: email.h:74
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:62
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:43
struct Body * body
List of MIME parts.
Definition: email.h:69
bool subject_changed
Used for threading.
Definition: email.h:106
bool active
Message is not to be removed.
Definition: email.h:76
void * nm_edata
Notmuch private data.
Definition: email.h:93
char * tree
Character string to print thread tree.
Definition: email.h:125
bool old
Email is seen, but unread.
Definition: email.h:49
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
Definition: email.h:123
void(* edata_free)(void **ptr)
Definition: email.h:90
bool zoccident
True, if west of UTC, False if east.
Definition: email.h:58
bool changed
Email has been edited.
Definition: email.h:77
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:71
bool attach_del
Has an attachment marked for deletion.
Definition: email.h:99
bool flagged
Marked important?
Definition: email.h:47
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
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition: email.h:112
unsigned int zhours
Hours away from UTC.
Definition: email.h:56
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:60
bool replied
Email has been replied to.
Definition: email.h:51
int vnum
Virtual message number.
Definition: email.h:114
bool expired
Already expired?
Definition: email.h:46
struct TagList tags
For drivers that support server tagging.
Definition: email.h:72
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition: email.h:73
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:70
size_t sequence
Sequence number assigned on creation.
Definition: email.h:67
bool deleted
Email is deleted.
Definition: email.h:78
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:53
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:52
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:61
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:196
int num_emails
Number of Emails the event applies to.
Definition: email.h:197
struct Email ** emails
Emails affected by the event.
Definition: email.h:198
An event that happened to a header.
Definition: email.h:217
char * header
The contents of the header.
Definition: email.h:218
A List node for strings.
Definition: list.h:37
An Email conversation.
Definition: thread.h:34
Notification API.
Definition: notify.c:53
Driver based email tags.