Skip to content

Commit

Permalink
Enable chatting plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdjeg committed Nov 20, 2016
1 parent 9666c3f commit 67e038e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .vintrc.yaml
@@ -0,0 +1,9 @@
cmdargs:
# Checking more strictly
severity: style_problem

policies:
ProhibitImplicitScopeVariable:
enabled: false
ProhibitAbbreviationOption:
enabled: false
7 changes: 7 additions & 0 deletions autoload/chat.vim
@@ -0,0 +1,7 @@
function! chat#startServer(name) abort

endfunction

function! chat#openWin() abort

endfunction
47 changes: 47 additions & 0 deletions autoload/chat/chatting.vim
@@ -0,0 +1,47 @@
let s:server_lib = '/home/wsdjeg/sources/Chatting/target/Chatting-1.0-SNAPSHOT.jar'
let s:server_job_id = 0
let s:client_job_id = 0
let s:messages = []

function! s:push_message(msg) abort
if type(a:msg) == type([])
for m in a:msg
if !empty(m)
call add(s:messages, m)
endif
endfor
else
if !empty(m)
call add(s:messages, a:msg)
endif
endif
endfunction

function! chat#chatting#start() abort
if s:server_job_id == 0
let s:server_job_id = jobstart(['java', '-cp', s:server_lib, 'com.wsdjeg.chat.Server'],{
\ 'on_stdout' : function('s:server_handler'),
\ })
endif
endfunction

function! s:server_handler(id, data, event) abort
endfunction

function! s:client_handler(id, data, event) abort
if a:event ==# 'stdout'
call s:push_message(a:data)
endif
endfunction

function! chat#chatting#login(name, pw) abort
if s:client_job_id == 0
let s:client_job_id = jobstart(['java', '-cp', s:server_lib, 'com.wsdjeg.chat.Client'],{
\ 'on_stdout' : function('s:client_handler')
\ })
endif
endfunction

function! Test(str) abort
exe a:str
endfunction

0 comments on commit 67e038e

Please sign in to comment.