view xsotter_mail.rb @ 11:4dcbbfa7f191

Detect xsotter_class via .
author yuuji@gentei.org
date Sat, 11 Feb 2012 12:48:07 +0900
parents 83a2c410b901
children 42e9379d8c1d
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)

yatex.org