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