mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
remove last remnants of treating a mailbox named "Sent" specially, in favor of special-use mailbox flags
a few places still looked at the name "Sent". but since we have special-use flags, we should always look at those. this also changes the config so admins can specify different names for the special-use mailboxes to create for new accounts, e.g. in a different language. the old config option is still understood, just deprecated.
This commit is contained in:
@ -644,9 +644,33 @@ func PrepareStaticConfig(ctx context.Context, configFile string, conf *Config, c
|
||||
c.SpecifiedSMTPListenIPs = nil
|
||||
}
|
||||
|
||||
var zerouse config.SpecialUseMailboxes
|
||||
if len(c.DefaultMailboxes) > 0 && (c.InitialMailboxes.SpecialUse != zerouse || len(c.InitialMailboxes.Regular) > 0) {
|
||||
addErrorf("cannot have both DefaultMailboxes and InitialMailboxes")
|
||||
}
|
||||
// DefaultMailboxes is deprecated.
|
||||
for _, mb := range c.DefaultMailboxes {
|
||||
checkMailboxNormf(mb, "default mailbox")
|
||||
}
|
||||
checkSpecialUseMailbox := func(nameOpt string) {
|
||||
if nameOpt != "" {
|
||||
checkMailboxNormf(nameOpt, "special-use initial mailbox")
|
||||
if strings.EqualFold(nameOpt, "inbox") {
|
||||
addErrorf("initial mailbox cannot be set to Inbox (Inbox is always created)")
|
||||
}
|
||||
}
|
||||
}
|
||||
checkSpecialUseMailbox(c.InitialMailboxes.SpecialUse.Archive)
|
||||
checkSpecialUseMailbox(c.InitialMailboxes.SpecialUse.Draft)
|
||||
checkSpecialUseMailbox(c.InitialMailboxes.SpecialUse.Junk)
|
||||
checkSpecialUseMailbox(c.InitialMailboxes.SpecialUse.Sent)
|
||||
checkSpecialUseMailbox(c.InitialMailboxes.SpecialUse.Trash)
|
||||
for _, name := range c.InitialMailboxes.Regular {
|
||||
checkMailboxNormf(name, "regular initial mailbox")
|
||||
if strings.EqualFold(name, "inbox") {
|
||||
addErrorf("initial regular mailbox cannot be set to Inbox (Inbox is always created)")
|
||||
}
|
||||
}
|
||||
|
||||
checkTransportSMTP := func(name string, isTLS bool, t *config.TransportSMTP) {
|
||||
var err error
|
||||
|
Reference in New Issue
Block a user