mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 07:48:13 +03:00
rename a few variables for code consistency
This commit is contained in:
parent
96667a87eb
commit
edfc24a701
@ -2941,14 +2941,14 @@ func (c *conn) cmdRename(tag, cmd string, p *parser) {
|
|||||||
var changes []store.Change
|
var changes []store.Change
|
||||||
|
|
||||||
c.xdbwrite(func(tx *bstore.Tx) {
|
c.xdbwrite(func(tx *bstore.Tx) {
|
||||||
srcMB := c.xmailbox(tx, src, "NONEXISTENT")
|
mbSrc := c.xmailbox(tx, src, "NONEXISTENT")
|
||||||
|
|
||||||
// Handle common/simple case first.
|
// Handle common/simple case first.
|
||||||
if src != "Inbox" {
|
if src != "Inbox" {
|
||||||
var modseq store.ModSeq
|
var modseq store.ModSeq
|
||||||
var alreadyExists bool
|
var alreadyExists bool
|
||||||
var err error
|
var err error
|
||||||
changes, _, alreadyExists, err = c.account.MailboxRename(tx, &srcMB, dst, &modseq)
|
changes, _, alreadyExists, err = c.account.MailboxRename(tx, &mbSrc, dst, &modseq)
|
||||||
if alreadyExists {
|
if alreadyExists {
|
||||||
xusercodeErrorf("ALREADYEXISTS", "%s", err)
|
xusercodeErrorf("ALREADYEXISTS", "%s", err)
|
||||||
}
|
}
|
||||||
@ -2970,34 +2970,34 @@ func (c *conn) cmdRename(tag, cmd string, p *parser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var modseq store.ModSeq
|
var modseq store.ModSeq
|
||||||
dstMB, chl, err := c.account.MailboxEnsure(tx, dst, false, store.SpecialUse{}, &modseq)
|
mbDst, chl, err := c.account.MailboxEnsure(tx, dst, false, store.SpecialUse{}, &modseq)
|
||||||
xcheckf(err, "creating destination mailbox")
|
xcheckf(err, "creating destination mailbox")
|
||||||
changes = chl
|
changes = chl
|
||||||
|
|
||||||
// Copy mailbox annotations. ../rfc/5464:368
|
// Copy mailbox annotations. ../rfc/5464:368
|
||||||
qa := bstore.QueryTx[store.Annotation](tx)
|
qa := bstore.QueryTx[store.Annotation](tx)
|
||||||
qa.FilterNonzero(store.Annotation{MailboxID: srcMB.ID})
|
qa.FilterNonzero(store.Annotation{MailboxID: mbSrc.ID})
|
||||||
qa.FilterEqual("Expunged", false)
|
qa.FilterEqual("Expunged", false)
|
||||||
annotations, err := qa.List()
|
annotations, err := qa.List()
|
||||||
xcheckf(err, "get annotations to copy for inbox")
|
xcheckf(err, "get annotations to copy for inbox")
|
||||||
for _, a := range annotations {
|
for _, a := range annotations {
|
||||||
a.ID = 0
|
a.ID = 0
|
||||||
a.MailboxID = dstMB.ID
|
a.MailboxID = mbDst.ID
|
||||||
a.ModSeq = modseq
|
a.ModSeq = modseq
|
||||||
a.CreateSeq = modseq
|
a.CreateSeq = modseq
|
||||||
err := tx.Insert(&a)
|
err := tx.Insert(&a)
|
||||||
xcheckf(err, "copy annotation to destination mailbox")
|
xcheckf(err, "copy annotation to destination mailbox")
|
||||||
changes = append(changes, a.Change(dstMB.Name))
|
changes = append(changes, a.Change(mbDst.Name))
|
||||||
}
|
}
|
||||||
c.xcheckMetadataSize(tx)
|
c.xcheckMetadataSize(tx)
|
||||||
|
|
||||||
// Build query that selects messages to move.
|
// Build query that selects messages to move.
|
||||||
q := bstore.QueryTx[store.Message](tx)
|
q := bstore.QueryTx[store.Message](tx)
|
||||||
q.FilterNonzero(store.Message{MailboxID: srcMB.ID})
|
q.FilterNonzero(store.Message{MailboxID: mbSrc.ID})
|
||||||
q.FilterEqual("Expunged", false)
|
q.FilterEqual("Expunged", false)
|
||||||
q.SortAsc("UID")
|
q.SortAsc("UID")
|
||||||
|
|
||||||
newIDs, chl := c.xmoveMessages(tx, q, 0, modseq, &srcMB, &dstMB)
|
newIDs, chl := c.xmoveMessages(tx, q, 0, modseq, &mbSrc, &mbDst)
|
||||||
changes = append(changes, chl...)
|
changes = append(changes, chl...)
|
||||||
cleanupIDs = newIDs
|
cleanupIDs = newIDs
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user