chore(GODT-2576): Connector can send any flags to Gluon

Requires Gluon bump: https://github.com/ProtonMail/gluon/pull/344
This commit is contained in:
Leander Beernaert
2023-04-27 11:52:55 +02:00
parent 21b20ac420
commit c49b42060e
3 changed files with 22 additions and 7 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.18
require (
github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557
github.com/Masterminds/semver/v3 v3.2.0
github.com/ProtonMail/gluon v0.16.1-0.20230426114906-aed4b8adf482
github.com/ProtonMail/gluon v0.16.1-0.20230427090931-8b3ec72985ec
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
github.com/ProtonMail/go-proton-api v0.4.1-0.20230426081144-f77778bae1be
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton

2
go.sum
View File

@ -30,6 +30,8 @@ github.com/ProtonMail/docker-credential-helpers v1.1.0 h1:+kvUIpwWcbtP3WFv5sSvkF
github.com/ProtonMail/docker-credential-helpers v1.1.0/go.mod h1:mK0aBveCxhnQ756AmaTfXMZDeULvheYVhF/MWMErN5g=
github.com/ProtonMail/gluon v0.16.1-0.20230426114906-aed4b8adf482 h1:GvaYoE4Nj/l9L7hQnhGlu9s+IP6oqb4YPKR37GAjE+Y=
github.com/ProtonMail/gluon v0.16.1-0.20230426114906-aed4b8adf482/go.mod h1:yA4hk6CJw0BMo+YL8Y3ckCYs5L20sysu9xseshwY3QI=
github.com/ProtonMail/gluon v0.16.1-0.20230427090931-8b3ec72985ec h1:RRkoDUkPBjNBBkoDV02IAimxwWONmxP1bQ64jEDsAA0=
github.com/ProtonMail/gluon v0.16.1-0.20230427090931-8b3ec72985ec/go.mod h1:yA4hk6CJw0BMo+YL8Y3ckCYs5L20sysu9xseshwY3QI=
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a h1:D+aZah+k14Gn6kmL7eKxoo/4Dr/lK3ChBcwce2+SQP4=
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a/go.mod h1:oTGdE7/DlWIr23G0IKW3OXK9wZ5Hw1GGiaJFccTvZi4=
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=

View File

@ -650,15 +650,28 @@ func (user *User) handleUpdateMessageEvent(ctx context.Context, message proton.M
"subject": logging.Sensitive(message.Subject),
}).Info("Handling message updated event")
flags := imap.NewFlagSet()
if message.Seen() {
flags.AddToSelf(imap.FlagSeen)
}
if message.Starred() {
flags.AddToSelf(imap.FlagFlagged)
}
if message.IsDraft() {
flags.AddToSelf(imap.FlagDraft)
}
if message.IsRepliedAll == true || message.IsReplied == true { //nolint: gosimple
flags.AddToSelf(imap.FlagAnswered)
}
update := imap.NewMessageMailboxesUpdated(
imap.MessageID(message.ID),
mapTo[string, imap.MailboxID](wantLabels(user.apiLabels, message.LabelIDs)),
imap.MessageCustomFlags{
Seen: message.Seen(),
Flagged: message.Starred(),
Draft: message.IsDraft(),
Answered: message.IsRepliedAll == true || message.IsReplied == true, //nolint: gosimple
},
flags,
)
user.updateCh[message.AddressID].Enqueue(update)