Fix integration tests - compiting message flags

This commit is contained in:
Michal Horejsek
2020-08-17 09:10:03 +02:00
parent 1dcaa200e0
commit 6c93f1f1ec
3 changed files with 24 additions and 0 deletions

View File

@ -839,3 +839,22 @@ func (c *client) EmptyFolder(labelID, addressID string) (err error) {
err = res.Err()
return
}
// ComputeMessageFlagsByLabels returns flags based on labels.
func ComputeMessageFlagsByLabels(labels []string) (flag int64) {
for _, labelID := range labels {
switch labelID {
case SentLabel:
flag = (flag | FlagSent)
case ArchiveLabel, InboxLabel:
flag = (flag | FlagReceived)
}
}
// NOTE: if the labels are custom only
if flag == 0 {
flag = FlagReceived
}
return flag
}