# 
# rem2ics-0.91-durationfix.patch
# Author: Paul Hinze <paul dot t dot hinze at gmail dot com>
# Thanks to: Michael Schultz <mjschultz at gmail dot com>
#
# This should fix an issue where rem2ics 0.91 chokes on timed reminders with
# duration using `remind -s` as it functions in remind-03.01.03.
# 
# 
--- rem2ics	2007-02-14 12:37:32.000000000 -0600
+++ /usr/local/bin/rem2ics	2008-01-26 20:54:29.000000000 -0600
@@ -315,8 +315,14 @@
     if ($sf[4] ne "*") {  # a time was given
 	# When an event has a time, remind -s "helpfully" also
 	# puts it as text at the start of the text portion.
-	$sf[5] =~ m/^\d{1,2}\:\d{2}(a|p)m (.*)$/;
-	$sf[5] = $2;
+	# This takes the following form:
+	#   ##:##[a|p]m <rest of MSG>
+	# or, if the event has a duration:
+	#   ##:##[a|p]m-##:##[a|p]m <rest of MSG>
+	# Rather than a nasty regex, just splitting at the 
+	# first space does the trick.
+	my($extra_time, $textmsg) = split(' ', $sf[5], 2);
+	$sf[5] = $textmsg;
     }
 
     $v->{sf} = \@sf;
@@ -362,7 +368,6 @@
     }
 }
 
-
 # All of the individual events are in the @events array.  All of the
 # unique combinations of duration/event name are the keys in the
 # %grovel hash, the elements of which are references to an arrays of
