PM API: read field in messages name changed to unread

This commit is contained in:
Adam Pioterek 2018-10-19 17:51:01 +02:00
parent 10d56495fb
commit a4bd5e7dc9
No known key found for this signature in database
GPG Key ID: 2442E27776E0A578
3 changed files with 5 additions and 5 deletions

View File

@ -99,7 +99,7 @@ func hasLabel(msg *protonmail.Message, labelID string) bool {
// Doesn't support imap.DeletedFlag. // Doesn't support imap.DeletedFlag.
func fetchFlags(msg *protonmail.Message) []string { func fetchFlags(msg *protonmail.Message) []string {
var flags []string var flags []string
if msg.IsRead != 0 { if msg.Unread != 1 {
flags = append(flags, imap.SeenFlag) flags = append(flags, imap.SeenFlag)
} }
if msg.IsReplied != 0 || msg.IsRepliedAll != 0 { if msg.IsReplied != 0 || msg.IsRepliedAll != 0 {

View File

@ -51,7 +51,7 @@ type EventMessage struct {
} }
type EventMessageUpdate struct { type EventMessageUpdate struct {
IsRead *int Unread *int
Type *MessageType Type *MessageType
Time int64 Time int64
IsReplied *int IsReplied *int
@ -97,8 +97,8 @@ func (update *EventMessageUpdate) DiffLabelIDs(current []string) (added, removed
func (update *EventMessageUpdate) Patch(msg *Message) { func (update *EventMessageUpdate) Patch(msg *Message) {
msg.Time = update.Time msg.Time = update.Time
if update.IsRead != nil { if update.Unread != nil {
msg.IsRead = *update.IsRead msg.Unread = *update.Unread
} }
if update.Type != nil { if update.Type != nil {
msg.Type = *update.Type msg.Type = *update.Type

View File

@ -57,7 +57,7 @@ type Message struct {
ID string ID string
Order int64 Order int64
Subject string Subject string
IsRead int Unread int
Type MessageType Type MessageType
Sender *MessageAddress Sender *MessageAddress
ReplyTo *MessageAddress ReplyTo *MessageAddress