mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:40:06 +08:00
feat(gitter): display more message about connection process
This commit is contained in:
parent
54e121f85b
commit
3d957013f7
@ -195,6 +195,14 @@ let s:list_all_channels_jobid = -1
|
||||
let s:list_all_channels_result = []
|
||||
function! s:get_all_channels() abort
|
||||
if s:list_all_channels_jobid <= 0
|
||||
call chat#windows#push({
|
||||
\ 'user' : '--->',
|
||||
\ 'username' : '--->',
|
||||
\ 'room' : '',
|
||||
\ 'protocol' : 'gitter',
|
||||
\ 'msg' : 'listing gitter channels',
|
||||
\ 'time': strftime("%Y-%m-%d %H:%M"),
|
||||
\ })
|
||||
let cmd = printf('curl -s -H "Accept: application/json" -H "Authorization: Bearer %s" "https://api.gitter.im/v1/rooms"', g:chat_gitter_token)
|
||||
let s:list_all_channels_jobid = s:JOB.start(cmd, {
|
||||
\ 'on_stdout' : function('s:get_all_channels_stdout'),
|
||||
@ -223,6 +231,15 @@ function! s:get_all_channels_exit(id, data, event) abort
|
||||
endif
|
||||
if !chat#windows#is_opened()
|
||||
call chat#notify#noti('gitter protocol channels updated!')
|
||||
else
|
||||
call chat#windows#push({
|
||||
\ 'user' : '--->',
|
||||
\ 'username' : '--->',
|
||||
\ 'room' : '',
|
||||
\ 'protocol' : 'gitter',
|
||||
\ 'msg' : 'list channels done!',
|
||||
\ 'time': strftime("%Y-%m-%d %H:%M"),
|
||||
\ })
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -316,7 +316,7 @@ function! s:update_msg_screen() abort
|
||||
if s:msg_win_opened
|
||||
normal! gg"_dG
|
||||
let buffer = []
|
||||
let msgs = filter(deepcopy(s:messages), 'v:val["room"] ==# s:current_channel')
|
||||
let msgs = filter(deepcopy(s:messages), 'v:val["room"] ==# s:current_channel || (empty(v:val["room"]) && v:val["protocol"] ==# s:protocol)')
|
||||
for msg in msgs
|
||||
let name = s:get_str_with_width(msg['user'], 13)
|
||||
let message = s:get_lines_with_width(msg['msg'], winwidth('$') - 36)
|
||||
|
Loading…
Reference in New Issue
Block a user