changeset 7:ef8cc6249d53

delete 140 characters or less
author KAMURA Sota <c109047@e.koeki-u.ac.jp>
date Tue, 07 Feb 2012 21:09:09 +0900
parents 6c763cb4ea40
children 2ebeaae57e96
files xsotter_mail.rb
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/xsotter_mail.rb	Tue Feb 07 20:08:20 2012 +0900
+++ b/xsotter_mail.rb	Tue Feb 07 21:09:09 2012 +0900
@@ -6,7 +6,7 @@
 
 sender = ENV['SENDER']
 rcpt = ENV['RECIPIENT']
-body = "" #Array.new
+body = "" 
 if sender == nil || rcpt === nil 
   exit 0
 elsif/.*@.*/ !~ sender 
@@ -16,11 +16,25 @@
 while line = gets
   f=1 if /^$/=~line
   if f ==1 
-    body += line
+    body += line 
+  else
+    subject = line if /Subject/ =~ line
   end
 end
+
 body = NKF.nkf('-e', body)
-com=["-T", body]
+subject = NKF.nkf('-e', subject).split(/:/)[1]
+
+
+count = 0
+post=""
+subject += body
+subject.split(//).each{|str|
+  post += str
+  break if 139 == count += 1
+} 
+puts post = NKF.nkf('-w', post)
+com=["-T", post]
 
 #com=["-T", "test"]
 xsotter=Xsotter.new("/home/irhome/c109/c109047/xsotter/c109047_token")

yatex.org