notmuch: rename method to SetFlag

This commit is contained in:
Reto Brunner 2020-09-27 19:00:58 +02:00
parent dadc9bf2b3
commit c48f228fa5
2 changed files with 5 additions and 5 deletions

View file

@ -64,9 +64,9 @@ func (m *Message) NewBodyPartReader(requestedParts []int) (io.Reader, error) {
return lib.FetchEntityPartReader(msg, requestedParts) return lib.FetchEntityPartReader(msg, requestedParts)
} }
// SetOneFlag adds or removes a single flag from the message. // SetFlag adds or removes a flag from the message.
// Notmuch doesn't support all the flags, and for those this errors. // Notmuch doesn't support all the flags, and for those this errors.
func (m *Message) SetOneFlag(flag models.Flag, enable bool) error { func (m *Message) SetFlag(flag models.Flag, enable bool) error {
// Translate the flag into a notmuch tag, ignoring no-op flags. // Translate the flag into a notmuch tag, ignoring no-op flags.
var tag string var tag string
switch flag { switch flag {
@ -120,12 +120,12 @@ func (m *Message) SetOneFlag(flag models.Flag, enable bool) error {
// MarkAnswered either adds or removes the "replied" tag from the message. // MarkAnswered either adds or removes the "replied" tag from the message.
func (m *Message) MarkAnswered(answered bool) error { func (m *Message) MarkAnswered(answered bool) error {
return m.SetOneFlag(models.AnsweredFlag, answered) return m.SetFlag(models.AnsweredFlag, answered)
} }
// MarkRead either adds or removes the maildir.FlagSeen flag from the message. // MarkRead either adds or removes the maildir.FlagSeen flag from the message.
func (m *Message) MarkRead(seen bool) error { func (m *Message) MarkRead(seen bool) error {
return m.SetOneFlag(models.SeenFlag, seen) return m.SetFlag(models.SeenFlag, seen)
} }
// tags returns the notmuch tags of a message // tags returns the notmuch tags of a message

View file

@ -402,7 +402,7 @@ func (w *worker) handleFlagMessages(msg *types.FlagMessages) error {
w.err(msg, err) w.err(msg, err)
continue continue
} }
if err := m.SetOneFlag(msg.Flag, msg.Enable); err != nil { if err := m.SetFlag(msg.Flag, msg.Enable); err != nil {
w.w.Logger.Printf("could not set flag %v as %v for message: %v", msg.Flag, msg.Enable, err) w.w.Logger.Printf("could not set flag %v as %v for message: %v", msg.Flag, msg.Enable, err)
w.err(msg, err) w.err(msg, err)
continue continue