aboutsummaryrefslogtreecommitdiffstats
path: root/imap.go
diff options
context:
space:
mode:
authorLibravatarLibravatar Simon Ser <[email protected]> 2019-12-03 17:52:56 +0100
committerLibravatarLibravatar Simon Ser <[email protected]> 2019-12-03 17:52:56 +0100
commitb386d1c2bb0efacea2484b4aa2088c769e048a9c (patch)
tree03eb53b286715ce894e91f73aa5e77bb65b2705d /imap.go
parentb7be271560d2c24c9811076a58f8b8c799292659 (diff)
downloadalps-b386d1c2bb0efacea2484b4aa2088c769e048a9c.tar.gz
alps-b386d1c2bb0efacea2484b4aa2088c769e048a9c.tar.bz2
alps-b386d1c2bb0efacea2484b4aa2088c769e048a9c.zip
Fix mailbox view when empty
This fixes the second part of #14. References: https://todo.sr.ht/~sircmpwn/koushin/14
Diffstat (limited to 'imap.go')
-rw-r--r--imap.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/imap.go b/imap.go
index ca35005..748d5cb 100644
--- a/imap.go
+++ b/imap.go
@@ -216,7 +216,9 @@ func listMessages(conn *imapclient.Client, mboxName string) ([]imapMessage, erro
mbox := conn.Mailbox()
from := uint32(1)
to := mbox.Messages
- if mbox.Messages > n {
+ if mbox.Messages == 0 {
+ return nil, nil
+ } else if mbox.Messages > n {
from = mbox.Messages - n
}
seqSet := new(imap.SeqSet)