From 99f9eb438f0df0f53aa5f434d27a9849832c6cc6 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Thu, 20 Mar 2025 00:10:47 +0100 Subject: [PATCH] Minor cleanup: use the ModSeq from the Mailbox in a ChangeMailboxAdd, no need to add the ModSeq again --- store/account.go | 6 +++--- store/state.go | 5 ++--- webaccount/import.go | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/store/account.go b/store/account.go index e87fe03..1691f40 100644 --- a/store/account.go +++ b/store/account.go @@ -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 diff --git a/store/state.go b/store/state.go index 7120987..ede4d7b 100644 --- a/store/state.go +++ b/store/state.go @@ -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 } diff --git a/webaccount/import.go b/webaccount/import.go index e2cfd8b..4041859 100644 --- a/webaccount/import.go +++ b/webaccount/import.go @@ -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]})