NeoMutt  2018-07-16 +2225-8687db
Teaching an old dog new tricks
DOXYGEN
mailbox.h
Go to the documentation of this file.
1 
24 #ifndef MUTT_CORE_MAILBOX_H
25 #define MUTT_CORE_MAILBOX_H
26 
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"
33 
34 struct ConfigSubset;
35 struct Email;
36 
37 #define MB_NORMAL 0
38 #define MB_HIDDEN 1
39 
44 {
57 };
58 
63 {
64  MBN_CLOSED = 1,
69 };
70 
74 typedef uint16_t AclFlags;
75 #define MUTT_ACL_NO_FLAGS 0
76 #define MUTT_ACL_ADMIN (1 << 0)
77 #define MUTT_ACL_CREATE (1 << 1)
78 #define MUTT_ACL_DELETE (1 << 2)
79 #define MUTT_ACL_DELMX (1 << 3)
80 #define MUTT_ACL_EXPUNGE (1 << 4)
81 #define MUTT_ACL_INSERT (1 << 5)
82 #define MUTT_ACL_LOOKUP (1 << 6)
83 #define MUTT_ACL_POST (1 << 7)
84 #define MUTT_ACL_READ (1 << 8)
85 #define MUTT_ACL_SEEN (1 << 9)
86 #define MUTT_ACL_WRITE (1 << 10)
87 
88 #define MUTT_ACL_ALL ((1 << 11) - 1)
89 
93 struct Mailbox
94 {
95  struct Buffer *pathbuf;
96  char *realpath;
97  char *name;
98  struct ConfigSubset *sub;
99  off_t size;
100  bool has_new;
101 
102  // These next three are only set when MailCheckStats is set
103  int msg_count;
106 
107  int msg_new;
110 
111  struct Email **emails;
112  int email_max;
113  int *v2r;
114  int vcount;
115 
116  bool notified;
119  struct timespec mtime;
122 
123  const struct MxOps *mx_ops;
124 
125  bool append : 1;
126  bool changed : 1;
127  bool dontwrite : 1;
129  bool peekonly : 1;
130  bool quiet : 1;
131  bool readonly : 1;
132 
133  AclFlags rights;
134 
135 #ifdef USE_COMPRESSED
137 #endif
138 
139  struct Hash *id_hash;
140  struct Hash *subj_hash;
141  struct Hash *label_hash;
142 
143  struct Account *account;
144  int opened;
145 
146  int flags;
147 
148  void *mdata;
149  void (*free_mdata)(void **);
150 
151  struct Notify *notify;
152 };
153 
158 {
159  struct Mailbox *mailbox;
160  STAILQ_ENTRY(MailboxNode) entries;
161 };
162 STAILQ_HEAD(MailboxList, MailboxNode);
163 
168 {
169  struct Mailbox *mailbox;
170 };
171 
176 {
179 };
180 
181 void mailbox_changed (struct Mailbox *m, enum MailboxNotification action);
182 struct Mailbox *mailbox_find (const char *path);
183 struct Mailbox *mailbox_find_name (const char *name);
184 void mailbox_free (struct Mailbox **ptr);
185 struct Mailbox *mailbox_new (void);
186 void mailbox_size_add (struct Mailbox *m, const struct Email *e);
187 void mailbox_size_sub (struct Mailbox *m, const struct Email *e);
188 void mailbox_update (struct Mailbox *m);
189 
190 #endif /* MUTT_CORE_MAILBOX_H */
struct Email ** emails
Array of Emails.
Definition: mailbox.h:111
int msg_count
Total number of messages.
Definition: mailbox.h:103
off_t size
Size of the Mailbox.
Definition: mailbox.h:99
NotifyMailbox
Types of Mailbox Event.
Definition: mailbox.h:175
The envelope/body of an email.
Definition: email.h:37
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:108
int msg_unread
Number of unread messages.
Definition: mailbox.h:104
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:169
A Hash Table.
Definition: hash.h:61
int msg_flagged
Number of flagged messages.
Definition: mailbox.h:105
bool peekonly
Just taking a glance, revert atime.
Definition: mailbox.h:129
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:96
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:119
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:128
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:56
Mailbox was closed.
Definition: mailbox.h:64
#define STAILQ_ENTRY(type)
Definition: queue.h:325
An Event that happened to a Mailbox.
Definition: mailbox.h:167
void(* free_mdata)(void **)
Driver-specific data free function.
Definition: mailbox.h:149
int vcount
The number of virtual messages.
Definition: mailbox.h:114
Update internal tables.
Definition: mailbox.h:67
bool has_new
Mailbox has new mail.
Definition: mailbox.h:100
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:182
struct timespec last_visited
Time of last exit from this mailbox.
Definition: mailbox.h:120
char * name
A short name for the Mailbox.
Definition: mailbox.h:97
A new Mailbox has been created.
Definition: mailbox.h:177
enum MailboxType magic
Mailbox type.
Definition: mailbox.h:117
bool readonly
Don&#39;t allow changes to the mailbox.
Definition: mailbox.h:131
STAILQ_HEAD(MailboxList, MailboxNode)
struct timespec stats_last_checked
Mtime of mailbox the last time stats where checked.
Definition: mailbox.h:121
struct Mailbox * mailbox_new(void)
Create a new Mailbox.
Definition: mailbox.c:42
int opened
Number of times mailbox is opened.
Definition: mailbox.h:144
void * mdata
Driver specific data.
Definition: mailbox.h:148
uint16_t AclFlags
ACL Rights - These show permission to...
Definition: mailbox.h:74
&#39;Maildir&#39; Mailbox type
Definition: mailbox.h:51
int flags
e.g. MB_NORMAL
Definition: mailbox.h:146
void mailbox_changed(struct Mailbox *m, enum MailboxNotification action)
Notify observers of a change to a Mailbox.
Definition: mailbox.c:159
A set of inherited config items.
Definition: subset.h:32
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:55
int email_max
Number of pointers in emails.
Definition: mailbox.h:112
A mailbox.
Definition: mailbox.h:93
struct ConfigSubset * sub
Inherited config items.
Definition: mailbox.h:98
Clear the &#39;last-tagged&#39; pointer.
Definition: mailbox.h:68
Email list needs resorting.
Definition: mailbox.h:66
bool dontwrite
Don&#39;t write the mailbox on close.
Definition: mailbox.h:127
&#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:125
&#39;MH&#39; Mailbox type
Definition: mailbox.h:50
const struct MxOps * mx_ops
MXAPI callback functions.
Definition: mailbox.h:123
bool quiet
Inhibit status messages?
Definition: mailbox.h:130
Notification API.
Definition: notify.c:40
int msg_tagged
How many messages are tagged?
Definition: mailbox.h:109
AclFlags rights
ACL bits, see AclFlags.
Definition: mailbox.h:133
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:172
bool newly_created
Mbox or mmdf just popped into existence.
Definition: mailbox.h:118
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:54
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
struct Buffer * pathbuf
Definition: mailbox.h:95
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:113
Email list was changed.
Definition: mailbox.h:65
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:143
int msg_new
Number of new messages.
Definition: mailbox.h:107
struct Hash * subj_hash
Hash table by subject.
Definition: mailbox.h:140
void mailbox_update(struct Mailbox *m)
Get the mailbox&#39;s current size.
Definition: mailbox.c:141
MailboxNotification
Notifications about changes to a Mailbox.
Definition: mailbox.h:62
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:136
A Mailbox is about to be destroyed.
Definition: mailbox.h:178
bool notified
User has been notified.
Definition: mailbox.h:116
Time value with nanosecond precision.
Definition: file.h:45
List of Mailboxes.
Definition: mailbox.h:157
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
Definition: mailbox.c:78
bool changed
Mailbox has been modified.
Definition: mailbox.h:126
struct Notify * notify
Notifications handler.
Definition: mailbox.h:151
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
struct Hash * label_hash
Hash table for x-labels.
Definition: mailbox.h:141
struct Hash * id_hash
Hash table by msg id.
Definition: mailbox.h:139
The Mailbox API.
Definition: mx.h:104
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:159
struct Mailbox * mailbox_find_name(const char *name)
Find the mailbox with a given name.
Definition: mailbox.c:114