changeset 8:2ebeaae57e96

chop 140
author KAMURA Sota <c109047@e.koeki-u.ac.jp>
date Tue, 07 Feb 2012 23:26:41 +0900
parents ef8cc6249d53
children b62e23f84a36
files xsotter_class.rb xsotter_mail.rb
diffstat 2 files changed, 8 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/xsotter_class.rb	Tue Feb 07 21:09:09 2012 +0900
+++ b/xsotter_class.rb	Tue Feb 07 23:26:41 2012 +0900
@@ -10,7 +10,7 @@
 class Xsotter
   
   def initialize (token_path)
-   p  @path = File.expand_path(token_path)
+     @path = File.expand_path(token_path)
     # @path = File.expand_path("~") + "/.xsotter_token"
     @login = false
     @kcode = "-e"
--- a/xsotter_mail.rb	Tue Feb 07 21:09:09 2012 +0900
+++ b/xsotter_mail.rb	Tue Feb 07 23:26:41 2012 +0900
@@ -12,30 +12,19 @@
 elsif/.*@.*/ !~ sender 
   exit 0
 end
-
+subject=""
 while line = gets
   f=1 if /^$/=~line
-  if f ==1 
-    body += line 
+  if f == 1 
+   body += line 
   else
-    subject = line if /Subject/ =~ line
+    subject = line.split(/:/)[1] if /Subject/ =~ line
   end
 end
 
-body = NKF.nkf('-e', 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]
-
+post = subject + body
+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