aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/mail/importance.vim
blob: 6a5ed09692b052f19fc8c06b7a2f95f8ce36d746 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
let s:fields = {
      \ 'high': {
        \ 'Importance': 'High',
        \ 'X-Priority': '1',
        \},
      \ 'low': {
        \ 'Importance': 'Low',
        \ 'X-Priority': '5',
        \},
      \ 'normal': {},
      \}

function! mail#importance#Set(level) abort
  let header = mail#header#Read()
  let fields = s:fields[a:level]
  for name in ['Importance', 'X-Priority']
    if has_key(fields, name)
      call mail#header#field#Set(header, name, fields[name])
    else
      call mail#header#field#Clear(header, name)
    endif
  endfor
  call mail#header#Write(header)
endfunction