[PATCH 02/13] mailbox default options
Bron Gondwana
brong at fastmail.fm
Tue Jan 27 23:15:29 EST 2009
Add a config variable mailbox_default_options which allows you to,
for example, enable CONDSTORE on all new mailboxes by default.
It's a bitmask, which is on the skanky end of interfaces, but there
you go.
---
imap/mailbox.c | 8 +++++---
lib/imapoptions | 5 +++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/imap/mailbox.c b/imap/mailbox.c
index 58ed79b..c421b56 100644
--- a/imap/mailbox.c
+++ b/imap/mailbox.c
@@ -959,7 +959,8 @@ int mailbox_read_index_header(struct mailbox *mailbox)
ntohl(*((bit32 *)(mailbox->index_base+OFFSET_HIGHESTMODSEQ)));
#endif
- if (!mailbox->exists) mailbox->options |= OPT_POP3_NEW_UIDL;
+ if (!mailbox->exists)
+ mailbox->options |= OPT_POP3_NEW_UIDL;
if (!mailbox_doing_reconstruct &&
(mailbox->minor_version < MAILBOX_MINOR_VERSION)) {
@@ -1637,7 +1638,8 @@ static void mailbox_upgrade_index_work(struct mailbox *mailbox,
calculate_flagcounts = 1;
}
if (oldstart_offset < OFFSET_MAILBOX_OPTIONS-quota_offset+sizeof(bit32)) {
- unsigned long options = !exists ? OPT_POP3_NEW_UIDL : 0;
+ unsigned long options = config_getint(IMAPOPT_MAILBOX_DEFAULT_OPTIONS);
+ if (!exists) options |= OPT_POP3_NEW_UIDL;
*((bit32 *)(buf+OFFSET_MAILBOX_OPTIONS)) = htonl(options);
}
@@ -2730,7 +2732,7 @@ int mailbox_create(const char *name,
mailbox.deleted = 0;
mailbox.answered = 0;
mailbox.flagged = 0;
- mailbox.options = OPT_POP3_NEW_UIDL;
+ mailbox.options = config_getint(IMAPOPT_MAILBOX_DEFAULT_OPTIONS) | OPT_POP3_NEW_UIDL;
mailbox.leaked_cache_records = 0;
mailbox.highestmodseq = 1;
diff --git a/lib/imapoptions b/lib/imapoptions
index 0e6f4eb..cb05645 100644
--- a/lib/imapoptions
+++ b/lib/imapoptions
@@ -534,6 +534,11 @@ are listed with ``<none>''.
/* Include notations in the protocol telemetry logs indicating the number of
seconds since the last command or response. */
+{ "mailbox_default_options", 0, INT }
+/* Default "options" field for the mailbox on create. You'll want to know
+ what you're doing before setting this, but it can apply some default
+ annotations like condstore or duplicate supression */
+
{ "mailnotifier", NULL, STRING }
/* Notifyd(8) method to use for "MAIL" notifications. If not set, "MAIL"
notifications are disabled. */
--
1.5.6.3
More information about the Cyrus-devel
mailing list