1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:30:04 +08:00

fix(gitter): debug function for listing channels

This commit is contained in:
wsdjeg 2022-05-05 19:43:21 +08:00
parent 7997125071
commit 70a3ba0ed3

View File

@ -229,11 +229,12 @@ function! s:get_all_channels_stderr(id, data, event) abort
endfor
let s:list_all_channels_stderr = s:list_all_channels_stderr + a:data
endfunction
" I am not sure if this is a bug. sometimes the exit data is 0, but there no
" stdout, all responses are sent to stderr.
function! s:get_all_channels_exit(id, data, event) abort
call s:LOG.debug('get_all_channels_exit code: ' . a:data)
if a:data ==# 0 && !empty(s:list_all_channels_stdout)
let s:channels = s:JSON.json_decode(join(s:list_all_channels_stdout, ''))
endif
call chat#windows#push({
\ 'user' : '--->',
\ 'username' : '--->',
@ -245,6 +246,19 @@ function! s:get_all_channels_exit(id, data, event) abort
if !chat#windows#is_opened()
call chat#notify#noti('gitter protocol channels updated!')
endif
else
call chat#windows#push({
\ 'user' : '--->',
\ 'username' : '--->',
\ 'room' : '',
\ 'protocol' : 'gitter',
\ 'msg' : 'failed to list channels of gitter protocol!',
\ 'time': strftime("%Y-%m-%d %H:%M"),
\ })
if !chat#windows#is_opened()
call chat#notify#noti('failed to list channels of gitter protocol!')
endif
endif
endfunction
function! Test(str) abort