Changeset 1966

Show
Ignore:
Timestamp:
09/25/06 20:31:29
Author:
miyagawa
Message:

fixed printed format to deal with AllDay? events. Allow --month today to display this month events

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • misc/30boxes

    r1965 r1966  
    7575    # map month to start/end 
    7676    if ($args{month}) { 
    77         $args{start} = parse_date($args{month}); 
    78         my($year, $month, $day) = split /-/, $args{start}
     77        my $target = parse_date($args{month}); 
     78        my($year, $month, $day) = split /-/, $target
    7979        my $end = Date_DaysInMonth($month, $year); 
     80        $args{start} = "$year-$month-1"; 
    8081        $args{end}   = "$year-$month-$end"; 
    8182    } 
     
    135136    my @events = @{ $res->{eventList}->{event} }; 
    136137    for my $event (sort { $a->{start} cmp $b->{start} } @events) { 
    137         printf "%8s %s %s\n", $event->{id}, $event->{start}, $event->{summary}; 
     138        my($date, $time) = split / /, $event->{start}; 
     139        printf "%8s %s %s (%s)\n", 
     140            $event->{id}, 
     141            $date, 
     142            $event->{summary}, 
     143            ($event->{allDayEvent} ? 'All day' : $time), 
    138144    } 
    139145} 
     
    173179 
    174180    my $res  = $ua->get($url); 
    175     my $data = XML::Simple::XMLin($res->content, ForceArray => [ 'event' ], KeyAttr => undef); 
     181    my $data = XML::Simple::XMLin($res->content, ForceArray => [ 'event', 'tags' ], KeyAttr => undef); 
    176182    if ($data->{stat} ne 'ok') { 
    177183        die "call API failed. You might need to remove $conf to redo the authentication.";