From a4bd5e7dc991227c04bfb82a7269d991813c6d33 Mon Sep 17 00:00:00 2001 From: Adam Pioterek Date: Fri, 19 Oct 2018 17:51:01 +0200 Subject: [PATCH] PM API: read field in messages name changed to unread --- imap/message.go | 2 +- protonmail/events.go | 6 +++--- protonmail/messages.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imap/message.go b/imap/message.go index 48dab72..8b22266 100644 --- a/imap/message.go +++ b/imap/message.go @@ -99,7 +99,7 @@ func hasLabel(msg *protonmail.Message, labelID string) bool { // Doesn't support imap.DeletedFlag. func fetchFlags(msg *protonmail.Message) []string { var flags []string - if msg.IsRead != 0 { + if msg.Unread != 1 { flags = append(flags, imap.SeenFlag) } if msg.IsReplied != 0 || msg.IsRepliedAll != 0 { diff --git a/protonmail/events.go b/protonmail/events.go index ba41e22..f7831da 100644 --- a/protonmail/events.go +++ b/protonmail/events.go @@ -51,7 +51,7 @@ type EventMessage struct { } type EventMessageUpdate struct { - IsRead *int + Unread *int Type *MessageType Time int64 IsReplied *int @@ -97,8 +97,8 @@ func (update *EventMessageUpdate) DiffLabelIDs(current []string) (added, removed func (update *EventMessageUpdate) Patch(msg *Message) { msg.Time = update.Time - if update.IsRead != nil { - msg.IsRead = *update.IsRead + if update.Unread != nil { + msg.Unread = *update.Unread } if update.Type != nil { msg.Type = *update.Type diff --git a/protonmail/messages.go b/protonmail/messages.go index 005ff58..8c79d8e 100644 --- a/protonmail/messages.go +++ b/protonmail/messages.go @@ -57,7 +57,7 @@ type Message struct { ID string Order int64 Subject string - IsRead int + Unread int Type MessageType Sender *MessageAddress ReplyTo *MessageAddress