diff --git a/README.md b/README.md index 0560de4..3658da5 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ __Optional ~/.vimrc Variables:__ * let g:vimchat\_buddylistmaxwidth = max width of buddy list window, default '' * let g:vimchat\_timestampformat = format of the message timestamp, default "[%H:%M]" * let g:vimchat\_showPresenceNotification = notification if buddy changed status, comma-separated list of states, default "" +* let g:vimchat\_restoreSessionStatus = (0 or 1), default is 0 # Hacking @@ -88,7 +89,6 @@ __Optional ~/.vimrc Variables:__ * All python code should follow pep8 guidelines * All new features should update documentation in the README - # Contributors * Philipp [philsmd](https://github.com/philsmd) diff --git a/plugin/vimchat.vim b/plugin/vimchat.vim index 4ab3c36..57cecd4 100644 --- a/plugin/vimchat.vim +++ b/plugin/vimchat.vim @@ -30,6 +30,7 @@ " g:vimchat_timestampformat = format of the msg timestamp default "[%H:%M]" " g:vimchat_showPresenceNotification = " notify if buddy changed status default "" +" g:vimchat_restoreSessionStatus = (0 or 1) default is 0 python <") while(size > 0): account = accounts.keys()[0] self._signOff(account) @@ -881,6 +930,16 @@ class VimChatScope: accounts = self.accounts if account in accounts: try: + # Save the status of this account to the config file + if self.sessionStatusRestore==1: + [show,status] = accounts[account].jabberGetPresence() + priority = accounts[account]._presence.getPriority() + if not show: show='' + if not status: status='' + if not priority: priority='' + self.setLastStatus(account, str(show), str(status), + str(priority)) + # disconnect and stop accounts[account].disconnect() accounts[account].stop() del accounts[account] @@ -895,9 +954,8 @@ class VimChatScope: else: print 'Error: [%s] is an invalid account.' % (account) if self.growl_enabled: - self.growl_notifier.notify("account status", "VimChat", - "Error signing off %s VimChat" %(account), - self.growl_icon) + self.growl_notifier.notify("account status", "VimChat", + "Error signing off %s VimChat" %(account), self.growl_icon) def showStatus(self): print self.accounts[self.accounts.keys()[0]].jabberGetPresence() @@ -1727,6 +1785,9 @@ fu! VimChatCheckVars() if !exists('g:vimchat_showPresenceNotification') let g:vimchat_showPresenceNotification="" endif + if !exists('g:vimchat_restoreSessionStatus') + let g:vimchat_restoreSessionStatus=0 + endif return 1 endfu