NeoMutt  2019-12-07-60-g0cfa53
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/mutt.h"
34 struct Email;
36 #define MB_NORMAL 0
37 #define MB_HIDDEN 1
43 {
56 };
61 typedef uint16_t AclFlags;
62 #define MUTT_ACL_NO_FLAGS 0
63 #define MUTT_ACL_ADMIN (1 << 0)
64 #define MUTT_ACL_CREATE (1 << 1)
65 #define MUTT_ACL_DELETE (1 << 2)
66 #define MUTT_ACL_DELMX (1 << 3)
67 #define MUTT_ACL_EXPUNGE (1 << 4)
68 #define MUTT_ACL_INSERT (1 << 5)
69 #define MUTT_ACL_LOOKUP (1 << 6)
70 #define MUTT_ACL_POST (1 << 7)
71 #define MUTT_ACL_READ (1 << 8)
72 #define MUTT_ACL_SEEN (1 << 9)
73 #define MUTT_ACL_WRITE (1 << 10)
75 #define MUTT_ACL_ALL ((1 << 11) - 1)
80 struct Mailbox
81 {
82  struct Buffer pathbuf;
83  char *realpath;
84  char *name;
85  struct ConfigSubset *sub;
86  off_t size;
87  bool has_new;
89  // These next three are only set when MailCheckStats is set
90  int msg_count;
91  int msg_unread;
94  int msg_new;
96  int msg_tagged;
98  struct Email **emails;
99  int email_max;
100  int *v2r;
101  int vcount;
103  bool notified;
106  struct timespec mtime;
110  const struct MxOps *mx_ops;
112  bool append : 1;
113  bool changed : 1;
114  bool dontwrite : 1;
116  bool peekonly : 1;
117  bool quiet : 1;
118  bool readonly : 1;
124 #endif
126  struct Hash *id_hash;
127  struct Hash *subj_hash;
128  struct Hash *label_hash;
130  struct Account *account;
131  int opened;
133  int flags;
135  void *mdata;
136  void (*free_mdata)(void **);
138  struct Notify *notify;
139 };
145 {
146  struct Mailbox *mailbox;
147  STAILQ_ENTRY(MailboxNode) entries;
148 };
149 STAILQ_HEAD(MailboxList, MailboxNode);
155 {
156  struct Mailbox *mailbox;
157 };
163 {
167  /* These don't really belong here as they are tied to GUI operations.
168  * Eventually, they'll be eliminated. */
174 };
176 void mailbox_changed (struct Mailbox *m, enum NotifyMailbox action);
177 struct Mailbox *mailbox_find (const char *path);
178 struct Mailbox *mailbox_find_name (const char *name);
179 void mailbox_free (struct Mailbox **ptr);
180 struct Mailbox *mailbox_new (void);
181 bool mailbox_set_subset(struct Mailbox *m, struct ConfigSubset *sub);
182 void mailbox_size_add (struct Mailbox *m, const struct Email *e);
183 void mailbox_size_sub (struct Mailbox *m, const struct Email *e);
184 void mailbox_update (struct Mailbox *m);
191 static inline const char *mailbox_path(const struct Mailbox *m)
192 {
193  return mutt_b2s(&m->pathbuf);
194 }
196 #endif /* MUTT_CORE_MAILBOX_H */
struct Email ** emails
Array of Emails.
Definition: mailbox.h:98
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox&#39;s path string.
Definition: mailbox.h:191
int msg_count
Total number of messages.
Definition: mailbox.h:90
off_t size
Size of the Mailbox.
Definition: mailbox.h:86
Types of Mailbox Event.
Definition: mailbox.h:162
The envelope/body of an email.
Definition: email.h:37
Clear the &#39;last-tagged&#39; pointer.
Definition: mailbox.h:173
Update internal tables.
Definition: mailbox.h:172
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:95
int msg_unread
Number of unread messages.
Definition: mailbox.h:91
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:51
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:156
A Hash Table.
Definition: hash.h:61
int msg_flagged
Number of flagged messages.
Definition: mailbox.h:92
bool peekonly
Just taking a glance, revert atime.
Definition: mailbox.h:116
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:83
Match any Mailbox type.
Definition: mailbox.h:44
A group of associated Mailboxes.
Definition: account.h:36
struct timespec mtime
Time Mailbox was last changed.
Definition: mailbox.h:106
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:115
Mailbox wasn&#39;t recognised.
Definition: mailbox.h:46
Error occurred examining Mailbox.
Definition: mailbox.h:45
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:60
Email list was changed.
Definition: mailbox.h:170
#define STAILQ_ENTRY(type)
Definition: queue.h:324
An Event that happened to a Mailbox.
Definition: mailbox.h:154
void(* free_mdata)(void **)
Driver-specific data free function.
Definition: mailbox.h:136
Mailbox was closed.
Definition: mailbox.h:169
int vcount
The number of virtual messages.
Definition: mailbox.h:101
bool has_new
Mailbox has new mail.
Definition: mailbox.h:87
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:195
struct timespec last_visited
Time of last exit from this mailbox.
Definition: mailbox.h:107
char * name
A short name for the Mailbox.
Definition: mailbox.h:84
A new Mailbox has been created.
Definition: mailbox.h:164
enum MailboxType magic
Mailbox type.
Definition: mailbox.h:104
bool readonly
Don&#39;t allow changes to the mailbox.
Definition: mailbox.h:118
STAILQ_HEAD(MailboxList, MailboxNode)
struct timespec stats_last_checked
Mtime of mailbox the last time stats where checked.
Definition: mailbox.h:108
struct Mailbox * mailbox_new(void)
Create a new Mailbox.
Definition: mailbox.c:42
int opened
Number of times mailbox is opened.
Definition: mailbox.h:131
void * mdata
Driver specific data.
Definition: mailbox.h:135
uint16_t AclFlags
ACL Rights - These show permission to...
Definition: mailbox.h:61
&#39;Maildir&#39; Mailbox type
Definition: mailbox.h:50
int flags
Definition: mailbox.h:133
Email list needs resorting.
Definition: mailbox.h:171
#define mutt_b2s(buf)
Definition: buffer.h:41
A set of inherited config items.
Definition: subset.h:44
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:54
int email_max
Number of pointers in emails.
Definition: mailbox.h:99
A mailbox.
Definition: mailbox.h:80
struct ConfigSubset * sub
Inherited config items.
Definition: mailbox.h:85
bool dontwrite
Don&#39;t write the mailbox on close.
Definition: mailbox.h:114
void mailbox_changed(struct Mailbox *m, enum NotifyMailbox action)
Notify observers of a change to a Mailbox.
Definition: mailbox.c:171
&#39;mmdf&#39; Mailbox type
Definition: mailbox.h:48
Compressed file Mailbox type.
Definition: mailbox.h:55
bool append
Mailbox is opened in append mode.
Definition: mailbox.h:112
&#39;MH&#39; Mailbox type
Definition: mailbox.h:49
const struct MxOps * mx_ops
MXAPI callback functions.
Definition: mailbox.h:110
bool quiet
Inhibit status messages?
Definition: mailbox.h:117
Notification API.
Definition: notify.c:40
int msg_tagged
How many messages are tagged?
Definition: mailbox.h:96
AclFlags rights
ACL bits, see AclFlags.
Definition: mailbox.h:120
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:185
bool mailbox_set_subset(struct Mailbox *m, struct ConfigSubset *sub)
Set a Mailbox&#39;s Config Subset.
Definition: mailbox.c:206
bool newly_created
Mbox or mmdf just popped into existence.
Definition: mailbox.h:105
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:53
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:47
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:100
Supported mailbox formats.
Definition: mailbox.h:42
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:130
int msg_new
Number of new messages.
Definition: mailbox.h:94
struct Hash * subj_hash
Hash table by subject.
Definition: mailbox.h:127
void mailbox_update(struct Mailbox *m)
Get the mailbox&#39;s current size.
Definition: mailbox.c:153
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:123
A Mailbox is about to be destroyed.
Definition: mailbox.h:165
bool notified
User has been notified.
Definition: mailbox.h:103
Time value with nanosecond precision.
Definition: file.h:45
List of Mailboxes.
Definition: mailbox.h:144
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
Definition: mailbox.c:90
bool changed
Mailbox has been modified.
Definition: mailbox.h:113
struct Notify * notify
Notifications handler.
Definition: mailbox.h:138
struct Buffer pathbuf
Definition: mailbox.h:82
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:52
struct Hash * label_hash
Hash table for x-labels.
Definition: mailbox.h:128
struct Hash * id_hash
Hash table by msg id.
Definition: mailbox.h:126
The Mailbox API.
Definition: mx.h:103
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:146
struct Mailbox * mailbox_find_name(const char *name)
Find the mailbox with a given name.
Definition: mailbox.c:126