Changeset 5990 for lang/vim

Show
Ignore:
Timestamp:
02/01/08 18:00:37 (10 months ago)
Author:
silphire
Message:

lang/vim/tvitter: warn if update is overlonger than 140 characters

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/vim/tvitter/trunk/tvitter.vim

    r5754 r5990  
    33" License: distributed under the same terms of Vim itself 
    44" Created: 2008-01-20 
    5 " Version: 0.1 
     5" Version: 0.2 
    66" 
    77 
     
    6666endfunction 
    6767 
     68" 
     69function! s:CheckLength(msg) 
     70        let l:len = strlen(a:msg) 
     71        if l:len > 140 
     72                let l:answer = input("Overlong update (".l:len." bytes). Really send? ") 
     73                if(strlen(l:answer) > 0 && l:answer[0] == 'y') 
     74                        return 1 
     75                else 
     76                        return 0 
     77                endif 
     78        endif 
     79        return 1 
     80endfunction 
     81 
    6882"  
    6983function! s:ReflectResult(response) 
     
    8296        call s:GetMail() 
    8397        call s:GetPassword() 
     98 
     99        if !s:CheckLength(a:msg) 
     100                return 
     101        endif 
    84102 
    85103        let l:status = s:UrlEscape(a:msg)