summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartyn Smith <martyn@catalyst.net.nz>2008-04-06 10:54:32 +1200
committerMartyn Smith <martyn@dollyfish.net.nz>2008-04-06 10:54:32 +1200
commita83bdf1d2e8a0de8676037b2725073e634b5f845 (patch)
tree6bb12f1c86e71884d682d1bb6bf1130f0fb37d4c
parentfd68415fd2be22b2a00d882acfa22825aad6392d (diff)
downloadmutt-filters-a83bdf1d2e8a0de8676037b2725073e634b5f845.zip
Added support to parse version 1.0 documents
-rwxr-xr-xvcalendar-filter11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcalendar-filter b/vcalendar-filter
index de8ad8b..e065b0d 100755
--- a/vcalendar-filter
+++ b/vcalendar-filter
@@ -31,6 +31,16 @@ use Text::Autoformat;
my $body = eval { local $/ = undef; <> };
my $calendar = Data::ICal->new(data => $body);
+# If parsing failed, try parsing as version 1.0
+$calendar = Data::ICal->new(data => $body, vcal10 => 1) unless $calendar;
+
+# If parsing failed, give up :-(
+unless ( $calendar ) {
+ print "Unable to parse vcalendar: ", $calendar->error_message, "\n";
+ print $body;
+ exit 1;
+}
+
foreach my $entry ( @{$calendar->{entries}} ) {
my $properties;
@@ -60,6 +70,7 @@ foreach my $entry ( @{$calendar->{entries}} ) {
}
}
elsif ( $entry->ical_entry_type eq 'VEVENT' ) {
+ print '-' x 72, "\n";
foreach my $key ( qw(summary BR description BR location organizer dtstart dtend) ) {
if ( $key eq 'BR' ) {
print "\n";