#include "config.h"
#include <stdbool.h>
#include "mutt/lib.h"
#include "email.h"
#include "body.h"
#include "envelope.h"
#include "tags.h"
Go to the source code of this file.
Representation of an email
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file email.c.
◆ nm_edata_free()
void nm_edata_free |
( |
void ** |
ptr | ) |
|
Free data attached to an Email.
- Parameters
-
Each email has an attached NmEmailData, which contains things like the tags (labels).
Definition at line 41 of file edata.c.
◆ email_free()
void email_free |
( |
struct Email ** |
ptr | ) |
|
◆ email_new()
struct Email* email_new |
( |
void |
| ) |
|
Create a new Email.
- Return values
-
Definition at line 72 of file email.c.
◆ email_cmp_strict()
bool email_cmp_strict |
( |
const struct Email * |
e1, |
|
|
const struct Email * |
e2 |
|
) |
| |
Strictly compare message emails.
- Parameters
-
- Return values
-
true | Emails are strictly identical |
Definition at line 92 of file email.c.
◆ email_size()
size_t email_size |
( |
const struct Email * |
e | ) |
|
compute the size of an email
- Parameters
-
- Return values
-
num | Size of the email, in bytes |
Definition at line 117 of file email.c.
◆ emaillist_clear()
void emaillist_clear |
( |
struct EmailList * |
el | ) |
|
Drop a private list of Emails.
- Parameters
-
The Emails are not freed.
Definition at line 130 of file email.c.
135 struct EmailNode *en = NULL, *tmp = NULL;
◆ emaillist_add_email()
int emaillist_add_email |
( |
struct EmailList * |
el, |
|
|
struct Email * |
e |
|
) |
| |
Add an Email to a list.
- Parameters
-
e | Email to add |
el | EmailList to add to |
- Return values
-
Definition at line 151 of file email.c.
◆ header_find()
struct ListNode* header_find |
( |
const struct ListHead * |
hdrlist, |
|
|
const char * |
header |
|
) |
| |
Find a header, matching on its field, in a list of headers.
- Parameters
-
hdrlist | List of headers to search |
header | The header to search for |
- Return values
-
node | The node in the list matching the header |
NULL | If no matching header is found |
The header should either of the form "X-Header:" or "X-Header: value"
Definition at line 172 of file email.c.
174 const char *key_end = strchr(header,
':');
178 const int keylen = key_end - header + 1;
◆ header_add()
struct ListNode* header_add |
( |
struct ListHead * |
hdrlist, |
|
|
const char * |
header |
|
) |
| |
Add a header to a list.
- Parameters
-
hdrlist | List of headers to search |
header | String to set as the header |
- Return values
-
Definition at line 195 of file email.c.
◆ header_update()
Update an existing header.
- Parameters
-
hdr | The header to update |
header | String to update the header with |
- Return values
-
Definition at line 209 of file email.c.
◆ header_set()
struct ListNode* header_set |
( |
struct ListHead * |
hdrlist, |
|
|
const char * |
header |
|
) |
| |
Set a header value in a list.
- Parameters
-
hdrlist | List of headers to search |
header | String to set the value of the header to |
- Return values
-
node | The updated or created header |
If a header exists with the same field, update it, otherwise add a new header.
Definition at line 225 of file email.c.
◆ header_free()
void header_free |
( |
struct ListHead * |
hdrlist, |
|
|
struct ListNode * |
target |
|
) |
| |
Free and remove a header from a header list.
- Parameters
-
hdrlist | List to free the header from |
target | The header to free |
Definition at line 237 of file email.c.
long hdr_offset
Offset in stream where the headers begin.
time_t date_sent
Time when the message was sent (UTC)
#define STAILQ_INIT(head)
bool mime
Has a MIME-Version header?
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
int lines
How many lines in the body of this message?
LOFF_T offset
offset where the actual data begins
#define STAILQ_REMOVE(head, elm, type, field)
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
struct Email * email
Email in the list.
char * mutt_str_dup(const char *str)
Copy a string, safely.
char * path
Path of Email (for local Mailboxes)
void(* edata_free)(void **ptr)
Free the private data attached to the Email.
void mutt_body_free(struct Body **ptr)
Free a Body.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
#define STAILQ_FOREACH(var, head, field)
bool zoccident
True, if west of UTC, False if east.
size_t sequence
Sequence number assigned on creation.
char * tree
Character string to print thread tree.
time_t received
Time when the message was placed in the mailbox.
bool mutt_env_cmp_strict(const struct Envelope *e1, const struct Envelope *e2)
Strictly compare two Envelopes.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
bool mutt_body_cmp_strict(const struct Body *b1, const struct Body *b2)
Strictly compare two email Body's.
bool visible
Is this message part of the view?
unsigned int zminutes
Minutes away from UTC.
LOFF_T length
length (in bytes) of attachment
struct Envelope * env
Envelope information.
#define mutt_debug(LEVEL,...)
void nm_edata_free(void **ptr)
Free data attached to an Email.
unsigned int zhours
Hours away from UTC.
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
struct ListHead chain
Mixmaster chain.
struct ListNode * header_update(struct ListNode *hdr, const char *header)
Update an existing header.
void * edata
Driver-specific data.
struct TagList tags
For drivers that support server tagging.
#define STAILQ_INSERT_TAIL(head, elm, field)
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
Notmuch-specific Email data -.
The envelope/body of an email.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
@ LL_DEBUG2
Log at debug level 2.
void * nm_edata
Notmuch private data.
struct Body * body
List of MIME parts.