[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mhc:02113] Re: patch (today.in)
野口です。
# 再び、申し訳ありません。
先に御提案したパッチにバグがありました。
# --smtpserver に HOSTNAME のみを指定した場合に対応できていませんでした。
再提出いたします。
以上、ご検討いただれば幸いです。
--
NOGUCHI Yusuke <nogunogu@xxxxxxxxxxxxxxxxx>
*** today.in.org0 Mon Apr 25 22:01:21 2005
--- today.in Mon Apr 25 22:00:41 2005
***************
*** 17,24 ****
$DEBUG2 = false
- MailServer = 'localhost' ## for --mail option
MyHostName = 'localhost' ## for --mail option
require 'mhc-schedule'
require 'mhc-kconv'
--- 17,27 ----
$DEBUG2 = false
MyHostName = 'localhost' ## for --mail option
+ smtpServer = 'localhost' ## for --mail option
+ smtp_account = nil
+ smtp_passwd = nil
+ smtp_type = nil
require 'mhc-schedule'
require 'mhc-kconv'
***************
*** 49,65 ****
def usage(do_exit = true)
STDERR .print "usage: today [options]
Show your today's schedules.
! --help show this message.
! --format=FORMAT change output format to one of: ps, html
! --category=CATEGORY pick only in CATEGORY.
! '!' and space separated multiple values are allowed.
! --date=strig[+n] set a period of date.
! string is one of these:
! today, tomorrow, sun ... sat, yyyymmdd, yyyymm
! yyyymm lists all days in the month.
! list n+1 days of schedules if +n is given.
! default value is 'today+0'
! --mail=ADDRESS send a e-mail to ADDRESS instead of listing to stdout.\n"
exit if do_exit
end
--- 52,79 ----
def usage(do_exit = true)
STDERR .print "usage: today [options]
Show your today's schedules.
! --help show this message.
! --format=FORMAT change output format to one of: ps, html
! --category=CATEGORY pick only in CATEGORY.
! '!' and space separated multiple values are allowed.
! --date=strig[+n] set a period of date.
! string is one of these:
! today, tomorrow, sun ... sat, yyyymmdd, yyyymm
! yyyymm lists all days in the month.
! list n+1 days of schedules if +n is given.
! default value is 'today+0'
! --mail=ToADDRESS[[ToADDRESS2,...],FromAddress]
! send a e-mail to ToADDRESS(s) instead of listing
! to stdout.
! If you want to specify From:, set FromAddress.
! --smtpserver=HOSTNAME[,ACCOUNT,PASSWD,AUTHTYPE]
! specify SMTP Server when sending e-mail.
! If you have to use SMTP-AUTH, use below:
! ACCOUNT: Account for SMTP AUTH
! PASSWD: Passowrd for SMTP AUTH
! AUTHTYPE: Authentication method for SMTP AUTH
! (\"plain\" or \"cram_md5\" or \"login\")
! \n"
exit if do_exit
end
***************
*** 235,242 ****
date_from, date_to = string_to_date($1, $3) || usage()
when /^--mail=(.+)/
! mail_address = $1
!
else
usage()
end
--- 249,276 ----
date_from, date_to = string_to_date($1, $3) || usage()
when /^--mail=(.+)/
! mail_address = $1 .split(',')
! if mail_address .size > 1
! from_addr = mail_address[-1]
! mail_address .delete_at(-1)
! to_addr = mail_address
! else
! to_addr = mail_address[0]
! from_addr = "secretary-of-" + to_addr
! end
! when /^--smtpserver=(.+)/
! smtpServer, smtp_account, smtp_passwd, smtp_type = $1 .split(',')
! case smtp_type
! when "plain"
! smtp_type = :plain
! when "login"
! smtp_type = :login
! when "cram_md5"
! smtp_type = :cram_md5
! when nil
! else
! usage()
! end
else
usage()
end
***************
*** 251,259 ****
db = MhcScheduleDB .new
if mail_address
! header = "To: #{mail_address}\n"
! header += "From: secretary-of-#{mail_address}\n"
header += "Subject: Today's schedule (#{date_from .to_s})\n"
header += "\n"
header += "#{user_name}'s schedule: \n\n"
contents =
--- 285,295 ----
db = MhcScheduleDB .new
if mail_address
! date = Time.now.strftime("%a, %d %b %Y %H:%M:%S %z")
! header = "To: #{to_addr.join(' ,')}\n"
! header += "From: #{from_addr}\n"
header += "Subject: Today's schedule (#{date_from .to_s})\n"
+ header += "Date: #{date}\n"
header += "\n"
header += "#{user_name}'s schedule: \n\n"
contents =
***************
*** 261,268 ****
if contents && contents != ''
message = MhcKconv::tomail(header + contents)
! Net::SMTPSession .start(MailServer, 25, MyHostName) {|server|
! server .sendmail(message, mail_address, [mail_address])
}
end
else
--- 297,304 ----
if contents && contents != ''
message = MhcKconv::tomail(header + contents)
! Net::SMTPSession .start(smtpServer, 25, MyHostName, smtp_account, smtp_passwd, smtp_type) {|server|
! server .sendmail(message, from_addr, to_addr)
}
end
else