105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/vpim/agent/scraps.rb', line 105
def do_GET(req, resp)
cal = Vpim::Icalendar.create
open($vcf_bday_file) do |vcf|
Vpim::Vcard.decode(vcf).each do |card|
begin
bday = card.birthday
if bday
cal.push Vpim::Icalendar::Vevent.create_yearly(
card.birthday,
"Birthday for #{card['fn'].strip}"
)
$stderr.puts "#{card['fn']} -> bday #{cal.events.last.dtstart}"
end
rescue
$stderr.puts $!
$stderr.puts $!.backtrace.join("\n")
end
end
end
resp.body = cal.encode
resp['content-type'] = 'text/calendar'
raise WEBrick::HTTPStatus::OK
end
|