NeoMutt  2024-03-23-142-g2b2e76
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mailbox.h File Reference

Maildir Mailbox. More...

#include <stdbool.h>
#include <stdint.h>
#include "core/lib.h"
+ Include dependency graph for mailbox.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

enum MxStatus maildir_mbox_check (struct Mailbox *m)
 Check for new mail - Implements MxOps::mbox_check() -.
 
enum MxStatus maildir_mbox_check_stats (struct Mailbox *m, uint8_t flags)
 Check the Mailbox statistics - Implements MxOps::mbox_check_stats() -.
 
enum MxStatus maildir_mbox_close (struct Mailbox *m)
 Close a Mailbox - Implements MxOps::mbox_close() -.
 
enum MxOpenReturns maildir_mbox_open (struct Mailbox *m)
 Open a Mailbox - Implements MxOps::mbox_open() -.
 
bool maildir_mbox_open_append (struct Mailbox *m, OpenMailboxFlags flags)
 Open a Mailbox for appending - Implements MxOps::mbox_open_append() -.
 
enum MxStatus maildir_mbox_sync (struct Mailbox *m)
 Save changes to the Mailbox - Implements MxOps::mbox_sync() -.
 
void maildir_parse_flags (struct Email *e, const char *path)
 Parse Maildir file flags.
 

Detailed Description

Maildir Mailbox.

Authors
  • Richard Russon

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 mailbox.h.

Function Documentation

◆ maildir_parse_flags()

void maildir_parse_flags ( struct Email e,
const char *  path 
)

Parse Maildir file flags.

Parameters
eEmail
pathPath to email file

Definition at line 82 of file mailbox.c.

83{
84 char *q = NULL;
85
86 e->flagged = false;
87 e->read = false;
88 e->replied = false;
89
91
92 const char c_maildir_field_delimiter = *cc_maildir_field_delimiter();
93 char *p = strrchr(path, c_maildir_field_delimiter);
94 if (p && mutt_str_startswith(p + 1, "2,"))
95 {
96 p += 3;
97
98 mutt_str_replace(&edata->custom_flags, p);
99 q = edata->custom_flags;
100
101 while (*p)
102 {
103 switch (*p)
104 {
105 case 'F': // Flagged
106 e->flagged = true;
107 break;
108
109 case 'R': // Replied
110 e->replied = true;
111 break;
112
113 case 'S': // Seen
114 e->read = true;
115 break;
116
117 case 'T': // Trashed
118 {
119 const bool c_flag_safe = cs_subset_bool(NeoMutt->sub, "flag_safe");
120 if (!e->flagged || !c_flag_safe)
121 {
122 e->trash = true;
123 e->deleted = true;
124 }
125 break;
126 }
127
128 default:
129 *q++ = *p;
130 break;
131 }
132 p++;
133 }
134 }
135
136 if (q == edata->custom_flags)
137 FREE(&edata->custom_flags);
138 else if (q)
139 *q = '\0';
140}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
const char * cc_maildir_field_delimiter(void)
Get the cached value of $maildir_field_delimiter.
Definition: config_cache.c:131
struct MaildirEmailData * maildir_edata_get(struct Email *e)
Get the private data for this Email.
Definition: edata.c:64
#define FREE(x)
Definition: memory.h:45
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:230
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:329
bool read
Email is read.
Definition: email.h:50
void * edata
Driver-specific data.
Definition: email.h:74
bool flagged
Marked important?
Definition: email.h:47
bool replied
Email has been replied to.
Definition: email.h:51
char * path
Path of Email (for local Mailboxes)
Definition: email.h:70
bool deleted
Email is deleted.
Definition: email.h:78
bool trash
Message is marked as trashed on disk (used by the maildir_trash option)
Definition: email.h:53
Maildir-specific Email data -.
Definition: edata.h:32
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45