~emersion/public-inbox

hydroxide: imap: fix not being able to delete mails and [2000] IDs required v1 APPLIED

: 1
 imap: fix not being able to delete mails and [2000] IDs required

 1 files changed, 8 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/16022/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH hydroxide] imap: fix not being able to delete mails and [2000] IDs required Export this patch

From: MrViK <mrvikxd@gmail.com>

* Advertise imap.DeletedFlag on permanent flags
* Check if `mbox.deleted` has elements before sending API request
---
 imap/mailbox.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/imap/mailbox.go b/imap/mailbox.go
index 84bf4f8..1068c28 100644
--- a/imap/mailbox.go
+++ b/imap/mailbox.go
@@ -62,7 +62,7 @@ func (mbox *mailbox) Info() (*imap.MailboxInfo, error) {
func (mbox *mailbox) Status(items []imap.StatusItem) (*imap.MailboxStatus, error) {
	mbox.u.Lock()
	flags := []string{imap.SeenFlag, imap.DeletedFlag}
	permFlags := []string{imap.SeenFlag}
	permFlags := []string{imap.SeenFlag, imap.DeletedFlag}
	for _, flag := range mbox.u.flags {
		flags = append(flags, flag)
		permFlags = append(permFlags, flag)
@@ -550,8 +550,14 @@ func (mbox *mailbox) Expunge() error {
		return err
	}

	apiIDs := make([]string, 0, len(mbox.deleted))
	mbox.Lock()
	if len(mbox.deleted) == 0 {
		mbox.Unlock()
		return nil // Nothing to do
	}

	apiIDs := make([]string, 0, len(mbox.deleted))

	for apiID := range mbox.deleted {
		apiIDs = append(apiIDs, apiID)
	}
-- 
2.29.2
Thanks for the patch, pushed!