NeoMutt  2024-12-12-14-g7b49f7
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 81 of file mailbox.c.

82{
83 char *q = NULL;
84
85 e->flagged = false;
86 e->read = false;
87 e->replied = false;
88
90
91 const char c_maildir_field_delimiter = *cc_maildir_field_delimiter();
92 char *p = strrchr(path, c_maildir_field_delimiter);
93 if (p && mutt_str_startswith(p + 1, "2,"))
94 {
95 p += 3;
96
97 mutt_str_replace(&edata->custom_flags, p);
98 q = edata->custom_flags;
99
100 while (*p)
101 {
102 switch (*p)
103 {
104 case 'F': // Flagged
105 e->flagged = true;
106 break;
107
108 case 'R': // Replied
109 e->replied = true;
110 break;
111
112 case 'S': // Seen
113 e->read = true;
114 break;
115
116 case 'T': // Trashed
117 {
118 const bool c_flag_safe = cs_subset_bool(NeoMutt->sub, "flag_safe");
119 if (!e->flagged || !c_flag_safe)
120 {
121 e->trash = true;
122 e->deleted = true;
123 }
124 break;
125 }
126
127 default:
128 *q++ = *p;
129 break;
130 }
131 p++;
132 }
133 }
134
135 if (q == edata->custom_flags)
136 FREE(&edata->custom_flags);
137 else if (q)
138 *q = '\0';
139}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:47
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:63
#define FREE(x)
Definition: memory.h:55
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:280
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:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46