Changeset 330 for cybozu2ical/trunk

Show
Ignore:
Timestamp:
07/27/06 14:25:22 (2 years ago)
Author:
ogawa
Message:

Add TZID properties to DTSTART and DTEND.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cybozu2ical/trunk/cybozu2ical

    r329 r330  
    1919 
    2020our $VERSION = '0.05'; 
    21 our $ENCODE_NCR = 0; 
    2221 
    2322my %opt = (conf => 'config.yaml'); 
     
    2625 
    2726my $cfg = YAML::LoadFile($opt{conf}); 
    28 my $tz = DateTime::TimeZone->new(name => $cfg->{time_zone} || 'Asia/Tokyo'); 
    2927 
    3028my $ua = LWP::UserAgent->new(); 
     
    4644my @lines = grep /^\d+,ts\.\d+,/, split(/\r?\n/, $content); 
    4745 
     46my $tzid = $cfg->{time_zone} || 'Asia/Tokyo'; 
     47my $tz = DateTime::TimeZone->new(name => $tzid); 
     48 
    4849my $vcalendar = Data::ICal->new(); 
    4950$vcalendar->add_properties( 
     
    5253    method => 'PUBLISH', 
    5354    $cfg->{calname} ? ('X-WR-CALNAME' => $cfg->{calname}) : (), 
    54     $cfg->{time_zone} ? ('X-WR-TIMEZONE' => $cfg->{time_zone}) : (), 
     55    'X-WR-TIMEZONE' => $tzid 
    5556); 
    5657 
     
    8283                $dt0->add(minutes => 10) : dt2ical($dt1); 
    8384        } 
    84         $vevent->add_properties(dtstart => $dtstart, dtend => $dtend); 
     85        $vevent->add_properties( 
     86            dtstart => [$dtstart, { TZID => $tzid }], 
     87            dtend => [$dtend, { TZID => $tzid }] 
     88        ); 
    8589    } 
    8690 
     
    99103 
    100104my $vtimezone = Data::ICal::Entry::TimeZone->new(); 
    101 $vtimezone->add_properties(tzid => $tz->name); 
     105$vtimezone->add_properties(tzid => $tzid); 
    102106 
    103107# probably we need to support the Daylight Saving Time 
     
    119123 
    120124my $enc = $cfg->{output_encoding} || 'utf8'; 
    121 print ($enc eq 'ncr') ? 
     125print $enc eq 'ncr' ? 
    122126    encode_ncr($vcalendar->as_string) : 
    123127    encode($enc, $vcalendar->as_string);