mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 18:25:42 +08:00
feat(mail): add login & password option
This commit is contained in:
parent
31ab74f8be
commit
5ec1b3beb5
@ -16,6 +16,7 @@
|
|||||||
" 1. `imap_host`: set the imap server host
|
" 1. `imap_host`: set the imap server host
|
||||||
" 2. `imap_port`: set the imap server port
|
" 2. `imap_port`: set the imap server port
|
||||||
" 3. `imap_login`: set the login of imap server
|
" 3. `imap_login`: set the login of imap server
|
||||||
|
" 4. `imap_password`: set the password of imap server
|
||||||
"
|
"
|
||||||
" @subsection key bindings
|
" @subsection key bindings
|
||||||
" >
|
" >
|
||||||
@ -30,6 +31,7 @@ endif
|
|||||||
let s:imap_host = 'imap.163.com'
|
let s:imap_host = 'imap.163.com'
|
||||||
let s:imap_port = 143
|
let s:imap_port = 143
|
||||||
let s:imap_login = ''
|
let s:imap_login = ''
|
||||||
|
let s:imap_password = ''
|
||||||
|
|
||||||
function! SpaceVim#layers#mail#plugins() abort
|
function! SpaceVim#layers#mail#plugins() abort
|
||||||
return [
|
return [
|
||||||
@ -40,6 +42,8 @@ endfunction
|
|||||||
function! SpaceVim#layers#mail#set_variable(opt) abort
|
function! SpaceVim#layers#mail#set_variable(opt) abort
|
||||||
let s:imap_host = get(a:opt, 'imap_host', s:imap_host)
|
let s:imap_host = get(a:opt, 'imap_host', s:imap_host)
|
||||||
let s:imap_port = get(a:opt, 'imap_port', s:imap_port)
|
let s:imap_port = get(a:opt, 'imap_port', s:imap_port)
|
||||||
|
let s:imap_login = get(a:opt, 'imap_login', s:imap_login)
|
||||||
|
let s:imap_password = get(a:opt, 'imap_password', s:imap_password)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#mail#config() abort
|
function! SpaceVim#layers#mail#config() abort
|
||||||
@ -47,6 +51,7 @@ function! SpaceVim#layers#mail#config() abort
|
|||||||
let g:mail_imap_host = s:imap_port
|
let g:mail_imap_host = s:imap_port
|
||||||
let g:mail_imap_port = s:imap_port
|
let g:mail_imap_port = s:imap_port
|
||||||
let g:mail_imap_login = s:imap_login
|
let g:mail_imap_login = s:imap_login
|
||||||
|
let g:mail_imap_password = s:imap_password
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#mail#health() abort
|
function! SpaceVim#layers#mail#health() abort
|
||||||
|
@ -89,11 +89,9 @@ endfunction
|
|||||||
|
|
||||||
function! mail#client#open()
|
function! mail#client#open()
|
||||||
if s:job_id == 0
|
if s:job_id == 0
|
||||||
let username = input('USERNAME: ')
|
if !empty(g:mail_imap_login) && !empty(g:mail_imap_password)
|
||||||
let password = input('PASSWORD: ')
|
|
||||||
if !empty(username) && !empty(password)
|
|
||||||
call mail#client#connect(g:mail_imap_host, g:mail_imap_port)
|
call mail#client#connect(g:mail_imap_host, g:mail_imap_port)
|
||||||
call mail#client#send(mail#command#login(username, password))
|
call mail#client#send(mail#command#login(g:mail_imap_login, g:mail_imap_password))
|
||||||
call mail#client#send(mail#command#select(mail#client#win#currentDir()))
|
call mail#client#send(mail#command#select(mail#client#win#currentDir()))
|
||||||
call mail#client#send(mail#command#fetch('1:15', 'BODY[HEADER.FIELDS ("DATE" "FROM" "SUBJECT")]'))
|
call mail#client#send(mail#command#fetch('1:15', 'BODY[HEADER.FIELDS ("DATE" "FROM" "SUBJECT")]'))
|
||||||
call mail#client#send(mail#command#status('INBOX', '["RECENT"]'))
|
call mail#client#send(mail#command#status('INBOX', '["RECENT"]'))
|
||||||
|
@ -14,6 +14,9 @@ let g:mail_sending_address = 'wsdjeg@163.com'
|
|||||||
let g:mail_logger_silent = 0
|
let g:mail_logger_silent = 0
|
||||||
|
|
||||||
let g:mail_imap_host = get(g:, 'mail_imap_host', 'imap.163.com')
|
let g:mail_imap_host = get(g:, 'mail_imap_host', 'imap.163.com')
|
||||||
|
let g:mail_imap_port = get(g:, 'mail_imap_port', 143)
|
||||||
|
let g:mail_imap_login = get(g:, 'mail_imap_login', '')
|
||||||
|
let g:mail_imap_password = get(g:, 'mail_imap_password', '')
|
||||||
|
|
||||||
if !exists('g:mail_directory')
|
if !exists('g:mail_directory')
|
||||||
let g:mail_directory = expand('~/.vim-mail/')
|
let g:mail_directory = expand('~/.vim-mail/')
|
||||||
|
@ -4631,6 +4631,7 @@ LAYER OPTIONS
|
|||||||
1. `imap_host`: set the imap server host
|
1. `imap_host`: set the imap server host
|
||||||
2. `imap_port`: set the imap server port
|
2. `imap_port`: set the imap server port
|
||||||
3. `imap_login`: set the login of imap server
|
3. `imap_login`: set the login of imap server
|
||||||
|
4. `imap_password`: set the password of imap server
|
||||||
|
|
||||||
KEY BINDINGS
|
KEY BINDINGS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user