mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-15 08:09:11 +08:00
feat(gitter): check notification setting of a room
This commit is contained in:
parent
83fc0188ba
commit
b3fa6a1356
@ -67,6 +67,7 @@ function! s:gitter_stdout(id, data, event) abort
|
||||
\ 'time': s:format_time(msg.sent),
|
||||
\ })
|
||||
if !chat#windows#is_opened()
|
||||
\ && s:enable_notify(room)
|
||||
call chat#notify#noti(msg.fromUser.displayName . ': ' . msg.text)
|
||||
endif
|
||||
return
|
||||
@ -74,6 +75,15 @@ function! s:gitter_stdout(id, data, event) abort
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:enable_notify(room) abort
|
||||
let room = filter(deepcopy(s:channels), 'has_key(v:val, "uri") && v:val.uri ==# a:room && has_key(v:val, "lurk")')
|
||||
if !empty(room)
|
||||
return room[0].lurk
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:format_time(t) abort
|
||||
return matchstr(a:t, '\d\d\d\d-\d\d-\d\d') . ' ' . matchstr(a:t, '\d\d:\d\d')
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user