1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-23 17:49:57 +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,21 +229,35 @@ function! s:get_all_channels_stderr(id, data, event) abort
endfor endfor
let s:list_all_channels_stderr = s:list_all_channels_stderr + a:data let s:list_all_channels_stderr = s:list_all_channels_stderr + a:data
endfunction 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 function! s:get_all_channels_exit(id, data, event) abort
call s:LOG.debug('get_all_channels_exit code: ' . a:data) call s:LOG.debug('get_all_channels_exit code: ' . a:data)
if a:data ==# 0 && !empty(s:list_all_channels_stdout) if a:data ==# 0 && !empty(s:list_all_channels_stdout)
let s:channels = s:JSON.json_decode(join(s:list_all_channels_stdout, '')) let s:channels = s:JSON.json_decode(join(s:list_all_channels_stdout, ''))
endif call chat#windows#push({
call chat#windows#push({ \ 'user' : '--->',
\ 'user' : '--->', \ 'username' : '--->',
\ 'username' : '--->', \ 'room' : '',
\ 'room' : '', \ 'protocol' : 'gitter',
\ 'protocol' : 'gitter', \ 'msg' : 'list channels done!',
\ 'msg' : 'list channels done!', \ 'time': strftime("%Y-%m-%d %H:%M"),
\ 'time': strftime("%Y-%m-%d %H:%M"), \ })
\ }) if !chat#windows#is_opened()
if !chat#windows#is_opened() call chat#notify#noti('gitter protocol channels updated!')
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 endif
endfunction endfunction