NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
Go to the documentation of this file.
27 #include "config.h"
28 #include <stdbool.h>
29 #include <stdint.h>
30 #include <sys/types.h>
31 #include <time.h>
32 #include "mutt/lib.h"
34 struct ConfigSubset;
35 struct Email;
37 #define MB_NORMAL 0
38 #define MB_HIDDEN 1
44 {
57 };
62 typedef uint16_t AclFlags;
63 #define MUTT_ACL_NO_FLAGS 0
64 #define MUTT_ACL_ADMIN (1 << 0)
65 #define MUTT_ACL_CREATE (1 << 1)
66 #define MUTT_ACL_DELETE (1 << 2)
67 #define MUTT_ACL_DELMX (1 << 3)
68 #define MUTT_ACL_EXPUNGE (1 << 4)
69 #define MUTT_ACL_INSERT (1 << 5)
70 #define MUTT_ACL_LOOKUP (1 << 6)
71 #define MUTT_ACL_POST (1 << 7)
72 #define MUTT_ACL_READ (1 << 8)
73 #define MUTT_ACL_SEEN (1 << 9)
74 #define MUTT_ACL_WRITE (1 << 10)
76 #define MUTT_ACL_ALL ((1 << 11) - 1)
81 struct Mailbox
82 {
83  struct Buffer pathbuf;
84  char *realpath;
85  char *name;
86  struct ConfigSubset *sub;
87  off_t size;
88  bool has_new;
90  // These next three are only set when MailCheckStats is set
91  int msg_count;
92  int msg_unread;
95  int msg_new;
97  int msg_tagged;
99  struct Email **emails;
100  int email_max;
101  int *v2r;
102  int vcount;
104  bool notified;
107  struct timespec mtime;
111  const struct MxOps *mx_ops;
113  bool append : 1;
114  bool changed : 1;
115  bool dontwrite : 1;
117  bool peekonly : 1;
118  bool verbose : 1;
119  bool readonly : 1;
123 #ifdef USE_COMP_MBOX
125 #endif
127  struct HashTable *id_hash;
131  struct Account *account;
132  int opened;
134  uint8_t flags;
136  void *mdata;
146  void (*mdata_free)(void **ptr);
148  struct Notify *notify;
150  int gen;
151 };
157 {
158  struct Mailbox *mailbox;
159  STAILQ_ENTRY(MailboxNode) entries;
160 };
161 STAILQ_HEAD(MailboxList, MailboxNode);
172 {
178  /* These don't really belong here as they are tied to GUI operations.
179  * Eventually, they'll be eliminated. */
185 };
191 {
192  struct Mailbox *mailbox;
193 };
195 void mailbox_changed (struct Mailbox *m, enum NotifyMailbox action);
196 struct Mailbox *mailbox_find (const char *path);
197 struct Mailbox *mailbox_find_name (const char *name);
198 void mailbox_free (struct Mailbox **ptr);
199 int mailbox_gen (void);
200 struct Mailbox *mailbox_new (void);
201 bool mailbox_set_subset(struct Mailbox *m, struct ConfigSubset *sub);
202 void mailbox_size_add (struct Mailbox *m, const struct Email *e);
203 void mailbox_size_sub (struct Mailbox *m, const struct Email *e);
204 void mailbox_update (struct Mailbox *m);
205 void mailbox_gc_add (struct Email *e);
206 void mailbox_gc_run (void);
208 const char *mailbox_get_type_name(enum MailboxType type);
215 static inline const char *mailbox_path(const struct Mailbox *m) // LCOV_EXCL_LINE
216 {
217  return mutt_buffer_string(&m->pathbuf); // LCOV_EXCL_LINE
218 }
220 #endif /* MUTT_CORE_MAILBOX_H */
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox&#39;s path string.
Definition: mailbox.h:215
Mailbox is about to be deleted.
Definition: mailbox.h:174
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
int msg_count
Total number of messages.
Definition: mailbox.h:91
off_t size
Size of the Mailbox.
Definition: mailbox.h:87
Types of Mailbox Event.
Definition: mailbox.h:171
The envelope/body of an email.
Definition: email.h:37
A Hash Table.
Definition: hash.h:87
Clear the &#39;last-tagged&#39; pointer.
Definition: mailbox.h:184
Update internal tables.
Definition: mailbox.h:183
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:96
int msg_unread
Number of unread messages.
Definition: mailbox.h:92
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:192
struct HashTable * label_hash
Hash Table for x-labels.
Definition: mailbox.h:129
int msg_flagged
Number of flagged messages.
Definition: mailbox.h:93
bool peekonly
Just taking a glance, revert atime.
Definition: mailbox.h:117
Mailbox has been changed.
Definition: mailbox.h:176
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:84
Match any Mailbox type.
Definition: mailbox.h:45
A group of associated Mailboxes.
Definition: account.h:36
struct timespec mtime
Time Mailbox was last changed.
Definition: mailbox.h:107
String manipulation buffer.
Definition: buffer.h:33
bool first_check_stats_done
True when the check have been done at least on time.
Definition: mailbox.h:116
Mailbox wasn&#39;t recognised.
Definition: mailbox.h:47
Error occurred examining Mailbox.
Definition: mailbox.h:46
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:87
Email list was changed.
Definition: mailbox.h:180
void mailbox_gc_run(void)
Run the garbage-collection.
Definition: mailbox.c:278
#define STAILQ_ENTRY(type)
Definition: queue.h:327
An Event that happened to a Mailbox.
Definition: mailbox.h:190
const char * mailbox_get_type_name(enum MailboxType type)
Get the type of a Mailbox.
Definition: mailbox.c:292
int vcount
The number of virtual messages.
Definition: mailbox.h:102
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
void(* mdata_free)(void **ptr)
Free the private data attached to the Mailbox.
Definition: mailbox.h:146
bool has_new
Mailbox has new mail.
Definition: mailbox.h:88
void mailbox_size_sub(struct Mailbox *m, const struct Email *e)
Subtract an email&#39;s size from the total size of a Mailbox.
Definition: mailbox.c:233
struct timespec last_visited
Time of last exit from this mailbox.
Definition: mailbox.h:108
char * name
A short name for the Mailbox.
Definition: mailbox.h:85
Mailbox has been added.
Definition: mailbox.h:173
struct HashTable * id_hash
Hash Table by msg id.
Definition: mailbox.h:127
bool readonly
Don&#39;t allow changes to the mailbox.
Definition: mailbox.h:119
STAILQ_HEAD(MailboxList, MailboxNode)
struct timespec stats_last_checked
Mtime of mailbox the last time stats where checked.
Definition: mailbox.h:109
struct Mailbox * mailbox_new(void)
Create a new Mailbox.
Definition: mailbox.c:68
int opened
Number of times mailbox is opened.
Definition: mailbox.h:132
void * mdata
Driver specific data.
Definition: mailbox.h:136
uint16_t AclFlags
ACL Rights - These show permission to...
Definition: mailbox.h:62
struct HashTable * subj_hash
Hash Table by subject.
Definition: mailbox.h:128
&#39;Maildir&#39; Mailbox type
Definition: mailbox.h:51
Email list needs resorting.
Definition: mailbox.h:181
A set of inherited config items.
Definition: subset.h:46
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:55
int email_max
Number of pointers in emails.
Definition: mailbox.h:100
A mailbox.
Definition: mailbox.h:81
struct ConfigSubset * sub
Inherited config items.
Definition: mailbox.h:86
bool dontwrite
Don&#39;t write the mailbox on close.
Definition: mailbox.h:115
void mailbox_changed(struct Mailbox *m, enum NotifyMailbox action)
Notify observers of a change to a Mailbox.
Definition: mailbox.c:208
&#39;mmdf&#39; Mailbox type
Definition: mailbox.h:49
Compressed file Mailbox type.
Definition: mailbox.h:56
bool append
Mailbox is opened in append mode.
Definition: mailbox.h:113
&#39;MH&#39; Mailbox type
Definition: mailbox.h:50
bool verbose
Display status messages?
Definition: mailbox.h:118
const struct MxOps * mx_ops
MXAPI callback functions.
Definition: mailbox.h:111
Notification API.
Definition: notify.c:50
int msg_tagged
How many messages are tagged?
Definition: mailbox.h:97
AclFlags rights
ACL bits, see AclFlags.
Definition: mailbox.h:121
void mailbox_size_add(struct Mailbox *m, const struct Email *e)
Add an email&#39;s size to the total size of a Mailbox.
Definition: mailbox.c:223
All Mailboxes are about to be deleted.
Definition: mailbox.h:175
bool mailbox_set_subset(struct Mailbox *m, struct ConfigSubset *sub)
Set a Mailbox&#39;s Config Subset.
Definition: mailbox.c:244
bool newly_created
Mbox or mmdf just popped into existence.
Definition: mailbox.h:106
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:54
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:101
uint8_t flags
Definition: mailbox.h:134
Supported mailbox formats.
Definition: mailbox.h:43
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:131
int msg_new
Number of new messages.
Definition: mailbox.h:95
void mailbox_update(struct Mailbox *m)
Get the mailbox&#39;s current size.
Definition: mailbox.c:190
Current Mailbox has changed.
Definition: mailbox.h:182
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:124
bool notified
User has been notified.
Definition: mailbox.h:104
Time value with nanosecond precision.
Definition: file.h:48
List of Mailboxes.
Definition: mailbox.h:156
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
Definition: mailbox.c:125
bool changed
Mailbox has been modified.
Definition: mailbox.h:114
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
Definition: mailbox.h:148
void mailbox_gc_add(struct Email *e)
Add an Email to the garbage-collection set.
Definition: mailbox.c:265
int mailbox_gen(void)
Get the next generation number.
Definition: mailbox.c:58
struct Buffer pathbuf
Definition: mailbox.h:83
Convenience wrapper for the library headers.
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
int gen
Generation number, for sorting.
Definition: mailbox.h:150
Definition: mxapi.h:103
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:158
struct Mailbox * mailbox_find_name(const char *name)
Find the mailbox with a given name.
Definition: mailbox.c:162