Changeset 17068
- Timestamp:
- 08/04/08 22:19:48 (5 years ago)
- Files:
-
- 1 modified
-
lang/vim/ruby/mixi.vim (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/vim/ruby/mixi.vim
r15724 r17068 1 1 command! Mixi :call <SID>MixiStart() 2 command! MixiEcho :call <SID>MixiEchoStart() 2 3 3 4 function! s:MixiStart() … … 6 7 endfunction 7 8 9 function! s:MixiEchoStart() 10 set nonu 11 ruby mixi_run_echo 12 endfunction 13 8 14 ruby << EOF 15 class Symbol 16 def to_proc 17 Proc.new{ |obj, *args| obj.send(self, *args) } 18 end 19 end 20 9 21 class Mixi 10 22 def initialize(email, password, mixi_premium = false, image_dir = '~/.vim/mixi_images') … … 18 30 @agent = WWW::Mechanize.new 19 31 @agent.user_agent_alias = 'Mac Safari' 32 end 33 34 def post_echo(message) 35 page = @agent.get 'http://mixi.jp/home.pl' 36 form = page.forms[0] 37 form.email = @email 38 form.password = @password 39 @agent.submit form 40 41 page = @agent.get "http://mixi.jp/home.pl" 42 page = @agent.get(page.links.map(&:href).detect {|l| /recent_echo/ =~ l }) 43 form = page.forms[1] 44 form.body = message 45 page = @agent.submit form 20 46 end 21 47 … … 120 146 end 121 147 end 148 149 def mixi_run_echo 150 vim = VIM::Buffer.current 151 # If you need: 152 # return if VIM.evaluate('confirm("really?")') == 0 153 154 message = VIM.evaluate %[getline(1)] 155 156 # ~/.mixi 157 # line1: input your email 158 # line2: input your password 159 # line3: input "premium" if you are premium 160 m = 161 if File.exist?(File.expand_path('~/.mixi')) 162 mixi_config = File.read(File.expand_path('~/.mixi')) 163 email, password, premium = mixi_config.split(/\r?\n/) 164 Mixi.new email, password, (premium == 'premium') 165 else 166 m = Mixi.new 'YOUR_EMAIL', 'YOUR_PASSWORD' 167 end 168 # if you are mixi premium member: 169 # m = Mixi.new 'YOUR_EMAIL', 'YOUR_PASSWORD', true 170 m.post_echo message.toeuc 171 end 172 122 173 EOF
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)