From a64487d5db57b9e281a5953b082618d2c1fca8a4 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 13 Jan 2013 17:32:58 -0200 Subject: Removing old scripts and cleaning up some code --- misc/parse-remind | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 misc/parse-remind (limited to 'misc/parse-remind') diff --git a/misc/parse-remind b/misc/parse-remind new file mode 100755 index 0000000..bdd9f23 --- /dev/null +++ b/misc/parse-remind @@ -0,0 +1,41 @@ +#!/usr/bin/perl +# +# This script is designed to have an email piped to it eg. from mutt. +# It will split apart all the text/calendar attachments and enter them into +# the 'remind' calendar. +# + +use strict; +use warnings; + +use MIME::Parser; + +my $CONVERT = '~/.mutt/ical2rem.pl'; +my $REMINDERS = '~/remind/mutt.rem'; + +################################################################################ + +my $parser = new MIME::Parser; +$parser->output_under('/tmp'); +my $entity = $parser->parse(\*STDIN); + +my @parts = $entity->parts(); +my $count = 0; + +foreach my $part (@parts) { + if ($part->head->mime_type eq 'text/calendar') { + my $body = $part->bodyhandle; + my $cmd = $CONVERT.' '.$body->path.' >> '.$REMINDERS; + print STDERR `$cmd`; + last if ($? != 0); + $count++; + } +} + +$parser->filer->purge; +if ($count == 0) { + print STDERR "No calendar entries found."; + exit(1); +} + +exit(0); -- cgit v1.2.3