Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from ikazuhiro/work

Treat a schedule with empty X-SC-Cond: and X-SC-Day: headers as daily one.
  • Loading branch information...
commit e8c76453f81d1c271f1b21403754e131b1fd96ea 2 parents 1ac2e3e + 688d7c2
@yoshinari-nomura authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 ruby-ext/lib/mhc-schedule.rb
View
17 ruby-ext/lib/mhc-schedule.rb
@@ -1111,6 +1111,8 @@ class MhcScheduleDB
DEF_BASEDIR = HOME + '/Mail/schedule'
DEF_RCFILE = HOME + '/.schedule'
+ ALL = 'all'
+
def initialize(basedir = DEF_BASEDIR, *rcfiles)
@db = {}
@mtime = {}
@@ -1232,7 +1234,7 @@ def holiday?(date)
def search1(d, category = nil, do_update = true)
mon, wek, ord, day, date = d .m_s, d .w_s, d .o_s, d .d_s, d
- all, last = 'all', 'Last'
+ last = 'Last'
ret = []
category_ary, category_is_invert = nil, false
@@ -1246,9 +1248,9 @@ def search1(d, category = nil, do_update = true)
category_ary = category .split .collect{|x| x .capitalize}
end
- search_key = [date, mon+ord+wek, mon+all+wek, all+ord+wek,
- all+all+wek, mon+day, all+day]
- search_key << mon+last+wek << all+last+wek if d .o_last?
+ search_key = [date, mon+ord+wek, mon+ALL+wek, ALL+ord+wek,
+ ALL+ALL+wek, mon+day, ALL+day, mon+ALL, ALL+ALL]
+ search_key << mon+last+wek << ALL+last+wek if d .o_last?
update(d) if do_update
to_slots(d) .each{|slot|
@@ -1278,8 +1280,8 @@ def regist(slot, o)
day .each{|ymd|
_regist(slot, ymd, o)
}
- mon = ['all'] if (mon .empty?)
- ord = ['all'] if (ord .empty?)
+ mon = [ALL] if (mon .empty?)
+ ord = [ALL] if (ord .empty?)
mon .each{|mon|
ord .each{|ord|
@@ -1290,6 +1292,9 @@ def regist(slot, o)
num .each{|num|
_regist(slot, mon + format("%02d", num .to_i), o)
}
+ if (num.empty? && wek.empty? && (day.empty? || mon != ALL))
+ _regist(slot, mon + ALL, o)
+ end
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.