[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mhc:02109] Re: patch (mhc2ol.in, ruby-ext/lib/mhc-schedule.rb)



野口です。

> 取り込ませてもらいますので、ChangeLog の作成をお願いします。

以下でよいでしょうか。

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Support new option(-H). 
-H     : Add/Copy mhc articles to Outlook without HEADER part.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


> それから、mhc-schedule.rb はなるべく変更しないようにお願いします。
> dump_without_header というメソッドの拡張は mhc2ol.rb でもできるは
> ずです。
> mhc-schedule.rb という共通ライブラリの修正には、それなりの合意を取
> るプロセスが必要だと思いますので。

なるほど。そのような「メソッドの拡張」ができることを知りませんでした。
mhc-schedule.rb に手を入れない形でパッチを作りなおして見ましたが、いか
がでしょうか?

-- 
NOGUCHI Yusuke <nogunogu@xxxxxxxxxxxxxxxxx>

*** mhc-current-snap20050420/mhc2ol.in	Wed Oct 29 21:48:14 2003
--- mhc-current-snap20050420-new/mhc2ol.in	Sun Apr 24 13:54:37 2005
***************
*** 183,189 ****
  
  def usage
    print '
! usage: mhc2ol [-a | -i | -d | -N] [-n] [-s] [-m] [-r dir] [-c category] [YYYYMMDD-yyyymmdd]
  
    mhc2ol -- Add/Copy mhc articles to Outlook.
  
--- 183,189 ----
  
  def usage
    print '
! usage: mhc2ol [[-a | -i | -d | -N] [-H]] [-n] [-s] [-m] [-r dir] [-c category] [YYYYMMDD-yyyymmdd]
  
    mhc2ol -- Add/Copy mhc articles to Outlook.
  
***************
*** 197,202 ****
--- 197,203 ----
               will be lost.
      -N     : Copy only the articles that have been modified since
               the last execution.
+     -H     : Add/Copy mhc articles to Outlook without HEADER part.
      -n     : Do nothing effectives. Useful for checking.
      -s     : Split appointments and tasks.
      -m     : Append an additional category `MHC-sch\'.
***************
*** 324,335 ****
--- 325,344 ----
        return dates
      end
    end
+ 
+   def dump_without_header
+     desc = description .to_s
+     desc += "\n" if desc != '' and desc !~ /\n\z/n
+     
+     return desc
+   end
  end
  
  class Exporter
    @@sync_file = File .expand_path("~/Mail/schedule/.ol_sync")
    @@flag_verbose = false
    @@flag_install = false
+   @@flag_export_part = 'all' # 'all' || 'body_only'
    @@flag_noharm = false
    @@flag_timestamp = false
    @@mhc_category_name = 'MHC-sch'
***************
*** 457,464 ****
  	cat_string = @@mhc_category_name + "," + cat_string
        end
        appoint .Categories = cat_string
!       appoint .Body = MhcKconv::todisp(sch .dump())
! 
        # a reminder is valid for a future schedule.
        if sch .alarm() != nil then
  	appoint .ReminderSet = true
--- 466,477 ----
  	cat_string = @@mhc_category_name + "," + cat_string
        end
        appoint .Categories = cat_string
!       case $flag_export_part
!       when 'all'
! 	appoint .Body = MhcKconv::todisp(sch .dump())
!       when 'body_only'
! 	appoint .Body = MhcKconv::todisp(sch .dump_without_header())	
!       end
        # a reminder is valid for a future schedule.
        if sch .alarm() != nil then
  	appoint .ReminderSet = true
***************
*** 480,486 ****
  	cat_string = @@mhc_category_name + "," + cat_string
        end
        appoint .Categories = cat_string
!       appoint .Body = MhcKconv::todisp(sch .dump())
        appoint .Save() if !$flag_separation  || !todo_p
  
        # Copy TODO
--- 493,504 ----
  	cat_string = @@mhc_category_name + "," + cat_string
        end
        appoint .Categories = cat_string
!       case $flag_export_part
!       when 'all'
! 	appoint .Body = MhcKconv::todisp(sch .dump())
!       when 'body_only'
! 	appoint .Body = MhcKconv::todisp(sch .dump_without_header())	
!       end
        appoint .Save() if !$flag_separation  || !todo_p
  
        # Copy TODO
***************
*** 716,721 ****
--- 734,743 ----
    def Exporter.set_flag_discreet(flag)
      @@flag_discreet = flag
    end
+   
+   def Exporter.set_flag_export_part(flag)
+     @@flag_export_part = flag
+   end
  
    def Exporter.set_flag_noharm(flag)
      @@flag_noharm = flag
***************
*** 744,749 ****
--- 766,772 ----
  
  $flag_verbose = false
  $flag_noharm, $flag_append, $flag_install = false, false, false
+ $flag_export_part = 'all' # 'all' || 'body_only'
  $flag_from, $flag_to = nil, nil
  $flag_timestamp = nil
  $flag_category_regexp = Regexp .new("")
***************
*** 762,767 ****
--- 785,796 ----
      $flag_install = true
    when '-d'
      $flag_discreet = true
+   when '-H' 
+     if ($flag_noharm == true || $flag_append == true || $flag_install == true)
+       $flag_export_part = 'body_only'
+     else
+       usage()
+     end
    when '-n'
      $flag_noharm  = true
    when '-r'
***************
*** 819,824 ****
--- 848,854 ----
  Exporter .set_sync_filename($flag_dir + "/.ol_sync")
  Exporter .set_flag_verbose($flag_verbose)
  Exporter .set_flag_install($flag_install)
+ Exporter .set_flag_export_part($flag_export_part)
  Exporter .set_flag_discreet($flag_discreet)
  Exporter .set_flag_noharm($flag_noharm)
  Exporter .set_flag_timestamp($flag_timestamp)