aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/imap.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/imap.go')
-rw-r--r--plugins/base/imap.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/base/imap.go b/plugins/base/imap.go
index 16bd2ef..a7f4ea1 100644
--- a/plugins/base/imap.go
+++ b/plugins/base/imap.go
@@ -19,6 +19,9 @@ import (
type MailboxInfo struct {
*imap.MailboxInfo
+
+ Active bool
+ Unseen int
}
func (mbox *MailboxInfo) URL() *url.URL {
@@ -27,6 +30,15 @@ func (mbox *MailboxInfo) URL() *url.URL {
}
}
+func (mbox *MailboxInfo) HasAttr(flag string) bool {
+ for _, attr := range mbox.Attributes {
+ if attr == flag {
+ return true
+ }
+ }
+ return false
+}
+
func listMailboxes(conn *imapclient.Client) ([]MailboxInfo, error) {
ch := make(chan *imap.MailboxInfo, 10)
done := make(chan error, 1)
@@ -36,7 +48,7 @@ func listMailboxes(conn *imapclient.Client) ([]MailboxInfo, error) {
var mailboxes []MailboxInfo
for mbox := range ch {
- mailboxes = append(mailboxes, MailboxInfo{mbox})
+ mailboxes = append(mailboxes, MailboxInfo{mbox, false, -1})
}
if err := <-done; err != nil {
@@ -133,7 +145,7 @@ func getMailboxByType(conn *imapclient.Client, mboxType mailboxType) (*MailboxIn
if best == nil {
return nil, nil
}
- return &MailboxInfo{best}, nil
+ return &MailboxInfo{best, false, -1}, nil
}
func ensureMailboxSelected(conn *imapclient.Client, mboxName string) error {