Mercurial > hgrepos > hgweb.cgi > xsotter
view xsotter_mail.rb @ 12:42e9379d8c1d default tip
gem ver up to 1.8.20 twitter ver up 2.1.1
author | KAMURA Sota <c109047@e.koeki-u.ac.jp> |
---|---|
date | Thu, 22 Mar 2012 14:06:08 +0900 |
parents | 4dcbbfa7f191 |
children |
line wrap: on
line source
#!/home/irhome/c109/c109047/sun4v/ruby/bin/ruby # -*- coding: euc-jp -*- $LOAD_PATH.unshift(File.dirname($0)) require 'xsotter_class' sender = ENV['SENDER'] rcpt = ENV['RECIPIENT'] body = "" if sender == nil || rcpt === nil exit 0 elsif/.*@.*/ !~ sender exit 0 end subject="" while line = gets f=1 if /^$/=~line if f == 1 body += line else subject = line.split(/:/)[1] if /Subject/ =~ line end end if body.split(/^-+$/e).size >= 2 body = body.split(/^-+$/e) post = body[1] + subject + body[0] else post = subject + body end post = $& if /.{140}/me=~post com=["-T", NKF.nkf('-e',post)] #com=["-T", "test"] xsotter=Xsotter.new("/home/irhome/c109/c109047/xsotter/c109047_token") xsotter.comand(com)