Add labels to index format (%g)
Exposes the notmuch tags accordingly, stubs it for the maildir worker.
This commit is contained in:
parent
6794ce0d9c
commit
63391b7dca
|
@ -59,6 +59,8 @@ These options are configured in the *[ui]* section of aerc.conf.
|
|||
| %F
|
||||
: author name, or recipient name if the message is from you.
|
||||
The adderss is shown if no name part.
|
||||
| %g
|
||||
: message labels (for example notmuch tags)
|
||||
| %i
|
||||
: message id
|
||||
| %n
|
||||
|
|
|
@ -138,6 +138,10 @@ func ParseMessageFormat(
|
|||
retval = append(retval, 's')
|
||||
args = append(args, val)
|
||||
|
||||
case 'g':
|
||||
retval = append(retval, 's')
|
||||
args = append(args, strings.Join(msg.Labels, ", "))
|
||||
|
||||
case 'i':
|
||||
retval = append(retval, 's')
|
||||
args = append(args, msg.Envelope.MessageId)
|
||||
|
|
|
@ -149,6 +149,7 @@ func merge(to *models.MessageInfo, from *models.MessageInfo) {
|
|||
to.Envelope = from.Envelope
|
||||
}
|
||||
to.Flags = from.Flags
|
||||
to.Labels = from.Labels
|
||||
if from.Size != 0 {
|
||||
to.Size = from.Size
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ type MessageInfo struct {
|
|||
BodyStructure *BodyStructure
|
||||
Envelope *Envelope
|
||||
Flags []Flag
|
||||
Labels []string
|
||||
InternalDate time.Time
|
||||
RFC822Headers *mail.Header
|
||||
Size uint32
|
||||
|
|
|
@ -207,6 +207,7 @@ func parseAddressList(h *mail.Header, key string) ([]*models.Address, error) {
|
|||
type RawMessage interface {
|
||||
NewReader() (io.Reader, error)
|
||||
ModelFlags() ([]models.Flag, error)
|
||||
Labels() ([]string, error)
|
||||
UID() uint32
|
||||
}
|
||||
|
||||
|
@ -233,10 +234,15 @@ func MessageInfo(raw RawMessage) (*models.MessageInfo, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
labels, err := raw.Labels()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &models.MessageInfo{
|
||||
BodyStructure: bs,
|
||||
Envelope: env,
|
||||
Flags: flags,
|
||||
Labels: labels,
|
||||
InternalDate: env.Date,
|
||||
RFC822Headers: &mail.Header{msg.Header},
|
||||
Size: 0,
|
||||
|
|
|
@ -119,3 +119,7 @@ func translateFlags(maildirFlags []maildir.Flag) []models.Flag {
|
|||
func (m Message) UID() uint32 {
|
||||
return m.uid
|
||||
}
|
||||
|
||||
func (m Message) Labels() ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -102,6 +102,10 @@ func (m *Message) Tags() ([]string, error) {
|
|||
return m.db.MsgTags(m.key)
|
||||
}
|
||||
|
||||
func (m *Message) Labels() ([]string, error) {
|
||||
return m.Tags()
|
||||
}
|
||||
|
||||
func (m *Message) ModelFlags() ([]models.Flag, error) {
|
||||
var flags []models.Flag
|
||||
seen := true
|
||||
|
|
Loading…
Reference in New Issue