mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 05:08:14 +03:00
make code less indented
This commit is contained in:
parent
577944310c
commit
a5c64e4361
@ -2943,11 +2943,23 @@ func (c *conn) cmdRename(tag, cmd string, p *parser) {
|
||||
c.xdbwrite(func(tx *bstore.Tx) {
|
||||
srcMB := c.xmailbox(tx, src, "NONEXISTENT")
|
||||
|
||||
// Handle common/simple case first.
|
||||
if src != "Inbox" {
|
||||
var modseq store.ModSeq
|
||||
var alreadyExists bool
|
||||
var err error
|
||||
changes, _, alreadyExists, err = c.account.MailboxRename(tx, &srcMB, dst, &modseq)
|
||||
if alreadyExists {
|
||||
xusercodeErrorf("ALREADYEXISTS", "%s", err)
|
||||
}
|
||||
xcheckf(err, "renaming mailbox")
|
||||
return
|
||||
}
|
||||
|
||||
// Inbox is very special. Unlike other mailboxes, its children are not moved. And
|
||||
// unlike a regular move, its messages are moved to a newly created mailbox. We do
|
||||
// indeed create a new destination mailbox and actually move the messages.
|
||||
// ../rfc/9051:2101
|
||||
if src == "Inbox" {
|
||||
exists, err := c.account.MailboxExists(tx, dst)
|
||||
xcheckf(err, "checking if destination mailbox exists")
|
||||
if exists {
|
||||
@ -2988,18 +3000,6 @@ func (c *conn) cmdRename(tag, cmd string, p *parser) {
|
||||
newIDs, chl := c.xmoveMessages(tx, q, 0, modseq, &srcMB, &dstMB)
|
||||
changes = append(changes, chl...)
|
||||
cleanupIDs = newIDs
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var modseq store.ModSeq
|
||||
var alreadyExists bool
|
||||
var err error
|
||||
changes, _, alreadyExists, err = c.account.MailboxRename(tx, &srcMB, dst, &modseq)
|
||||
if alreadyExists {
|
||||
xusercodeErrorf("ALREADYEXISTS", "%s", err)
|
||||
}
|
||||
xcheckf(err, "renaming mailbox")
|
||||
})
|
||||
|
||||
cleanupIDs = nil
|
||||
|
@ -713,8 +713,15 @@ func importMessages(ctx context.Context, log mlog.Log, token string, acc *store.
|
||||
case "new", "cur", "tmp":
|
||||
mailbox := path.Dir(dir)
|
||||
ximportMaildir(mailbox, origName, r)
|
||||
default:
|
||||
if path.Base(name) == "dovecot-keywords" {
|
||||
return
|
||||
}
|
||||
|
||||
if path.Base(name) != "dovecot-keywords" {
|
||||
problemf("unrecognized file %s (skipping)", origName)
|
||||
return
|
||||
}
|
||||
|
||||
// Handle dovecot-keywords.
|
||||
mailbox := path.Dir(name)
|
||||
dovecotKeywords := map[rune]string{}
|
||||
words, err := store.ParseDovecotKeywordsFlags(r, log)
|
||||
@ -764,10 +771,6 @@ func importMessages(ctx context.Context, log mlog.Log, token string, acc *store.
|
||||
changes = append(changes, m.ChangeFlags(oflags))
|
||||
}
|
||||
delete(mailboxMissingKeywordMessages, mailbox)
|
||||
} else {
|
||||
problemf("unrecognized file %s (skipping)", origName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if zr != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user