mirror of
https://github.com/soywod/himalaya.git
synced 2024-09-05 18:41:11 +00:00
fix vim msg list and read
This commit is contained in:
parent
9931658ea3
commit
b9a9d0e687
|
@ -8,11 +8,15 @@ let s:draft = ""
|
||||||
" Message
|
" Message
|
||||||
|
|
||||||
function! s:format_msg_for_list(msg)
|
function! s:format_msg_for_list(msg)
|
||||||
let msg = copy(a:msg)
|
let msg = {}
|
||||||
let flag_new = index(msg.flags, "Seen") == -1 ? "✷" : " "
|
let msg.uid = a:msg.uid
|
||||||
let flag_flagged = index(msg.flags, "Flagged") == -1 ? " " : "!"
|
let flag_new = index(a:msg.flags, "Seen") == -1 ? "✷" : " "
|
||||||
let flag_replied = index(msg.flags, "Answered") == -1 ? " " : "↵"
|
let flag_flagged = index(a:msg.flags, "Flagged") == -1 ? " " : "!"
|
||||||
|
let flag_replied = index(a:msg.flags, "Answered") == -1 ? " " : "↵"
|
||||||
let msg.flags = printf("%s %s %s", flag_new, flag_replied, flag_flagged)
|
let msg.flags = printf("%s %s %s", flag_new, flag_replied, flag_flagged)
|
||||||
|
let msg.subject = a:msg.headers.subject
|
||||||
|
let msg.sender = a:msg.headers.from[0]
|
||||||
|
let msg.date = a:msg.date
|
||||||
return msg
|
return msg
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -61,13 +65,13 @@ function! himalaya#msg#read()
|
||||||
\"--account %s --mailbox %s read %d",
|
\"--account %s --mailbox %s read %d",
|
||||||
\[shellescape(account), shellescape(mbox), s:msg_id],
|
\[shellescape(account), shellescape(mbox), s:msg_id],
|
||||||
\printf("Fetching message %d", s:msg_id),
|
\printf("Fetching message %d", s:msg_id),
|
||||||
\0,
|
\1,
|
||||||
\)
|
\)
|
||||||
let attachment = msg.hasAttachment ? " []" : ""
|
let attachment = len(msg.attachments) > 0 ? " []" : ""
|
||||||
execute printf("silent! edit Himalaya read message [%d]%s", s:msg_id, attachment)
|
execute printf("silent! edit Himalaya read message [%d]%s", s:msg_id, attachment)
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
silent execute "%d"
|
silent execute "%d"
|
||||||
call append(0, split(substitute(msg.content, "\r", "", "g"), "\n"))
|
call append(0, split(substitute(msg.body.plain, "\r", "", "g"), "\n"))
|
||||||
silent execute "$d"
|
silent execute "$d"
|
||||||
setlocal filetype=himalaya-msg-read
|
setlocal filetype=himalaya-msg-read
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
|
|
|
@ -7,6 +7,9 @@ function! himalaya#shared#cli#call(cmd, args, log, should_throw)
|
||||||
redraw | call himalaya#shared#log#info(printf("%s [OK]", a:log))
|
redraw | call himalaya#shared#log#info(printf("%s [OK]", a:log))
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
|
let res = substitute(res, ":null", ":v:null", "g")
|
||||||
|
let res = substitute(res, ":true", ":v:true", "g")
|
||||||
|
let res = substitute(res, ":false", ":v:false", "g")
|
||||||
let res = eval(res)
|
let res = eval(res)
|
||||||
redraw | call himalaya#shared#log#info(printf("%s [OK]", a:log))
|
redraw | call himalaya#shared#log#info(printf("%s [OK]", a:log))
|
||||||
return res.response
|
return res.response
|
||||||
|
|
Loading…
Reference in a new issue