1
1
Fork 0
mirror of https://github.com/mjl-/mox.git synced 2025-04-21 21:40:01 +03:00

Minor cleanup: use the ModSeq from the Mailbox in a ChangeMailboxAdd, no need to add the ModSeq again

This commit is contained in:
Mechiel Lukkien 2025-03-20 00:10:47 +01:00
parent 9ca50ab207
commit 99f9eb438f
No known key found for this signature in database
3 changed files with 6 additions and 7 deletions

View file

@ -317,7 +317,7 @@ func (mb Mailbox) ChangeKeywords() ChangeMailboxKeywords {
}
func (mb Mailbox) ChangeAddMailbox(flags []string) ChangeAddMailbox {
return ChangeAddMailbox{Mailbox: mb, Flags: flags, ModSeq: mb.ModSeq}
return ChangeAddMailbox{Mailbox: mb, Flags: flags}
}
func (mb Mailbox) ChangeRemoveMailbox() ChangeRemoveMailbox {
@ -2587,7 +2587,7 @@ func (a *Account) MailboxEnsure(tx *bstore.Tx, name string, subscribe bool, spec
return Mailbox{}, nil, fmt.Errorf("looking up subscription for %q: %v", p, err)
}
changes = append(changes, ChangeAddMailbox{mb, flags, *modseq})
changes = append(changes, ChangeAddMailbox{mb, flags})
}
// Clear any special-use flags from existing mailboxes and assign them to this mailbox.
@ -3636,7 +3636,7 @@ func (a *Account) MailboxRename(tx *bstore.Tx, mbsrc *Mailbox, dst string, modse
} else if err != bstore.ErrAbsent {
return nil, false, false, fmt.Errorf("look up subscription for new parent %q: %v", parent.Name, err)
}
parentChanges = append(parentChanges, ChangeAddMailbox{parent, flags, *modseq})
parentChanges = append(parentChanges, ChangeAddMailbox{parent, flags})
}
mbsrc.ParentID = parent.ID

View file

@ -94,9 +94,8 @@ func (c ChangeRemoveMailbox) ChangeModSeq() ModSeq { return c.ModSeq }
// ChangeAddMailbox is sent for a newly created mailbox.
type ChangeAddMailbox struct {
Mailbox Mailbox
Flags []string // For flags like \Subscribed.
ModSeq ModSeq
Mailbox
Flags []string // For flags like \Subscribed.
}
func (c ChangeAddMailbox) ChangeModSeq() ModSeq { return c.ModSeq }

View file

@ -485,7 +485,7 @@ func importMessages(ctx context.Context, log mlog.Log, token string, acc *store.
err := tx.Insert(&store.Subscription{Name: p})
ximportcheckf(err, "subscribing to imported mailbox")
}
changes = append(changes, store.ChangeAddMailbox{Mailbox: *mb, Flags: []string{`\Subscribed`}, ModSeq: modseq})
changes = append(changes, store.ChangeAddMailbox{Mailbox: *mb, Flags: []string{`\Subscribed`}})
}
if prevMailbox != "" && mb.Name != prevMailbox {
sendEvent("count", importCount{prevMailbox, messages[prevMailbox]})