Skip to content

Commit

Permalink
Made g:vimchat_accounts optional.
Browse files Browse the repository at this point in the history
git-svn-id: http://vimchat.googlecode.com/svn/trunk@141 d1d492a2-f496-11dd-9d1d-173cc1d06e3c
  • Loading branch information
naveedm9 committed Jul 19, 2009
1 parent f8b0b5a commit f89f870
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
10 changes: 6 additions & 4 deletions config
Expand Up @@ -2,10 +2,12 @@
# edit and write this file and vimchat will update itself on the fly. # edit and write this file and vimchat will update itself on the fly.
# #
# Accounts entries are in the form: username@server/resource = password. # Accounts entries are in the form: username@server/resource = password.
# The /resource and password are optional. If you leave the password blank, # The '/resource' part of the account is optional. It is a jabber feature that
# vimchat will prompt you for it when you connect. This accounts will be # lets you associate physical locations with your accounts. The password is
# connected to automatically when vimchat starts. You may connect or # optional as well. If you leave the password blank, vimchat will prompt you
# disconnect from a particular account with \on and \off. # for it when you connect. These accounts will be connected to automatically
# when vimchat starts. You may connect or disconnect from a particular account
# with \on and \off.


[accounts] [accounts]
#bob@gmail.com = #bob@gmail.com =
Expand Down
22 changes: 6 additions & 16 deletions plugin/vimchat.vim
Expand Up @@ -18,12 +18,11 @@
" "
" Supported ~/.vimrc Variables: " Supported ~/.vimrc Variables:
" g:vimchat_accounts = {'jabber id':'password',...} " g:vimchat_accounts = {'jabber id':'password',...}
"
" g:vimchat_buddylistwidth = width of buddy list " g:vimchat_buddylistwidth = width of buddy list
" g:vimchat_libnotify = (0 or 1) default is 1 " g:vimchat_libnotify = (0 or 1) default is 1
" g:vimchat_logpath = path to store log files " g:vimchat_logpath = path to store log files
" g:vimchat_logchats = (0 or 1) default is 1 " g:vimchat_logchats = (0 or 1) default is 1
" g:vimchat_otr = (0 or 1) default is 1 " g:vimchat_otr = (0 or 1) default is 0
" g:vimchat_logotr = (0 or 1) default is 1 " g:vimchat_logotr = (0 or 1) default is 1
" g:vimchat_statusicon = (0 or 1) default is 1 " g:vimchat_statusicon = (0 or 1) default is 1


Expand Down Expand Up @@ -136,12 +135,10 @@ class VimChatScope:
self.statusIcon.start() self.statusIcon.start()


# Signon to accounts listed in .vimrc # Signon to accounts listed in .vimrc
vimChatAccounts = vim.eval('g:vimchat_accounts') if vim.eval("exists('g:vimchat_accounts')") == '1':
for jid,password in vimChatAccounts.items(): vimChatAccounts = vim.eval('g:vimchat_accounts')
pass for jid,password in vimChatAccounts.items():
if password == '': self._signOn(jid,password)
password = vim.eval('inputsecret("' + jid + ' password: ")')
self._signOn(jid,password)


# Signon to accounts listed in .vimchat/config # Signon to accounts listed in .vimchat/config
if os.path.exists(self.configFilePath): if os.path.exists(self.configFilePath):
Expand All @@ -150,9 +147,6 @@ class VimChatScope:
if config.has_section('accounts'): if config.has_section('accounts'):
for jid in config.options('accounts'): for jid in config.options('accounts'):
password = config.get('accounts', jid) password = config.get('accounts', jid)
if not password:
password = vim.eval(
'inputsecret("' + jid + ' password: ")')
self._signOn(jid, password) self._signOn(jid, password)


#}}} #}}}
Expand Down Expand Up @@ -1637,10 +1631,6 @@ set switchbuf=usetab
"}}} "}}}
"{{{ VimChatCheckVars "{{{ VimChatCheckVars
fu! VimChatCheckVars() fu! VimChatCheckVars()
if !exists('g:vimchat_accounts')
echo "Must set g:vimchat_accounts in ~/.vimrc!"
return 0
endif
if !exists('g:vimchat_buddylistwidth') if !exists('g:vimchat_buddylistwidth')
let g:vimchat_buddylistwidth=30 let g:vimchat_buddylistwidth=30
endif endif
Expand All @@ -1654,7 +1644,7 @@ fu! VimChatCheckVars()
let g:vimchat_logchats=1 let g:vimchat_logchats=1
endif endif
if !exists('g:vimchat_otr') if !exists('g:vimchat_otr')
let g:vimchat_otr=1 let g:vimchat_otr=0
endif endif
if !exists('g:vimchat_logotr') if !exists('g:vimchat_logotr')
let g:vimchat_logotr=1 let g:vimchat_logotr=1
Expand Down

0 comments on commit f89f870

Please sign in to comment.