From e43bd231eddf7526fee2cfa63d975a960829f036 Mon Sep 17 00:00:00 2001 From: Michal Horejsek Date: Fri, 24 Apr 2020 10:06:24 +0200 Subject: [PATCH] Final touches of go-imap v1 implementation --- Changelog.md | 3 +++ internal/imap/mailbox.go | 7 ++++++- internal/store/change.go | 1 + test/features/imap/message/search.feature | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 5ba5cc0e..add16151 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,9 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) ### Changed * GODT-162 User Agent does not contain bridge version, only client in format `client name/client version (os)` +* GODT-258 Update go-imap to v1 + * Fix UNSEEN to return sequence number of first unseen message and not count of unseen messages + * INBOX name is never quoted * GODT-225 Do not send an EXISTS reposnse after EXPUNGE or when nothing changed (fixes rebuild of mailboxes in Outlook for Mac) * GODT-165 Optimization of RebuildMailboxes * GODT-282 Completely delete old draft instead moving to trash when user updates draft diff --git a/internal/imap/mailbox.go b/internal/imap/mailbox.go index 56947507..3919d1bc 100644 --- a/internal/imap/mailbox.go +++ b/internal/imap/mailbox.go @@ -126,7 +126,12 @@ func (im *imapMailbox) Status(items []imap.StatusItem) (*imap.MailboxStatus, err } dbTotal, dbUnread, dbUnreadSeqNum, err := im.storeMailbox.GetCounts() - l.Debugln("DB: total", dbTotal, "unread", dbUnread, "unreadSeqNum", dbUnreadSeqNum, "err", err) + l.WithFields(logrus.Fields{ + "total": dbTotal, + "unread": dbUnread, + "unreadSeqNum": dbUnreadSeqNum, + "err": err, + }).Debug("DB counts") if err == nil { status.Messages = uint32(dbTotal) status.Unseen = uint32(dbUnread) diff --git a/internal/store/change.go b/internal/store/change.go index d875c3f7..832bc56f 100644 --- a/internal/store/change.go +++ b/internal/store/change.go @@ -79,6 +79,7 @@ func (store *Store) imapDeleteMessage(address, mailboxName string, sequenceNumbe func (store *Store) imapMailboxCreated(address, mailboxName string) { store.log.WithFields(logrus.Fields{ "address": address, + "mailbox": mailboxName, }).Trace("IDLE mailbox info") update := new(imapBackend.MailboxInfoUpdate) update.Update = imapBackend.NewUpdate(address, "") diff --git a/test/features/imap/message/search.feature b/test/features/imap/message/search.feature index 473777fa..95dd9298 100644 --- a/test/features/imap/message/search.feature +++ b/test/features/imap/message/search.feature @@ -1,6 +1,8 @@ Feature: IMAP search messages Background: Given there is connected user "user" + # Messages are inserted in opposite way to keep increasing UID. + # Sequence numbers are then opposite than listed above. Given there are messages in mailbox "INBOX" for "user" | from | to | cc | subject | read | starred | body | | john.doe@email.com | user@pm.me | | foo | false | false | hello |