]> diplodocus.org Git - nmh/commitdiff
Fix to commit 6b073f7b67a0afd64012ff7d00818ec1bd07b5f2 to properly
authorDavid Levine <levinedl@acm.org>
Thu, 8 Jan 2015 02:13:41 +0000 (20:13 -0600)
committerDavid Levine <levinedl@acm.org>
Thu, 8 Jan 2015 02:13:41 +0000 (20:13 -0600)
detect a Content-Type header in output from converted content.

test/repl/test-convert
uip/mhbuildsbr.c

index fd1d1f6fbc9a58c4c7ff4d1770ec233e82cd704e..e85c9ccd7c1c1dbd1308d27c46a00f386a75937c 100755 (executable)
@@ -163,4 +163,113 @@ mhbuild "$actual"
 check "$actual" "$expected"
 
 
 check "$actual" "$expected"
 
 
+# check reply to calendar request
+cat >"$expected" <<'EOF'
+From: recipient@example.com
+To: sender@example.com
+cc: 
+Fcc: +outbox
+Subject: Re: test iCalendar reply
+Comments: In-reply-to sender@example.com
+   message dated "."
+MIME-Version: 1.0
+Content-Type: text/calendar; method="REPLY"; charset="UTF-8"
+
+BEGIN:VCALENDAR
+METHOD:REPLY
+PRODID:nmh mhical v0.1
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Eastern Standard Time
+BEGIN:STANDARD
+DTSTART:16010101T020000
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:16010101T020000
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+ORGANIZER;CN=Requester:MAILTO:requester@example.com
+ATTENDEE;PARTSTAT=ACCEPTED;CN=Recip:MAILTO:recipient@example.com
+SUMMARY;LANGUAGE=en-US:Accepted: test request
+DTSTART;TZID=Eastern Standard Time:20150105T090000
+DTEND;TZID=Eastern Standard Time:20150105T093000
+UID:0123456789
+CLASS:PUBLIC
+PRIORITY:5
+TRANSP:OPAQUE
+STATUS:CONFIRMED
+SEQUENCE:0
+LOCATION;LANGUAGE=en-US:
+END:VEVENT
+END:VCALENDAR
+EOF
+
+cat >`mhpath new` <<'EOF'
+From: sender@example.com
+To: recipient@example.com
+Subject: test iCalendar reply
+Content-Type: text/calendar; charset="UTF-8"
+MIME-Version: 1.0
+
+BEGIN:VCALENDAR
+METHOD:REQUEST
+PRODID:test-convert
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Eastern Standard Time
+BEGIN:STANDARD
+DTSTART:16010101T020000
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:16010101T020000
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+ORGANIZER;CN=Requester:MAILTO:requester@example.com
+ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
+ :MAILTO:requestee1@example.com
+ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
+ :MAILTO:requestee2@example.com
+ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
+ :MAILTO:requestee3@example.com
+SUMMARY;LANGUAGE=en-US:test request
+DTSTART;TZID=Eastern Standard Time:20150105T090000
+DTEND;TZID=Eastern Standard Time:20150105T093000
+UID:0123456789
+CLASS:PUBLIC
+PRIORITY:5
+DTSTAMP:20150101T171600Z
+TRANSP:OPAQUE
+STATUS:CONFIRMED
+SEQUENCE:0
+LOCATION;LANGUAGE=en-US:
+BEGIN:VALARM
+ACTION:DISPLAY
+DESCRIPTION:REMINDER
+TRIGGER;RELATED=START:-PT15M
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+EOF
+
+actual="$MH_TEST_DIR/test-convert$$.actual"
+repl -noformat \
+     -convertargs text/calendar '-reply accept -contenttype' -nowhatnowproc last
+SIGNATURE=Recip mhbuild - <`mhpath +`/draft | egrep -v '^DTSTAMP:' >"$actual"
+check "$actual" "$expected"
+
+
 exit $failed
 exit $failed
index 0773a075516e646b1e7587a18b1d0b4d6d990684..ff1bd3e98d68ef3e7d88240670f06351e3ca02ed 100644 (file)
@@ -2388,8 +2388,8 @@ extract_headers (CT ct, char *reply_file, FILE **reply_fp) {
     buffer[statbuf.st_size] = '\0';
 
     /* Look for a header in the convert reply. */
     buffer[statbuf.st_size] = '\0';
 
     /* Look for a header in the convert reply. */
-    if (strncasecmp (buffer, TYPE_FIELD, sizeof TYPE_FIELD) == 0  &&
-        buffer[sizeof TYPE_FIELD] == ':') {
+    if (strncasecmp (buffer, TYPE_FIELD, strlen (TYPE_FIELD)) == 0  &&
+        buffer[strlen (TYPE_FIELD)] == ':') {
         if ((end_of_header = strstr (buffer, "\r\n\r\n"))) {
             end_of_header += 2;
             found_header = 1;
         if ((end_of_header = strstr (buffer, "\r\n\r\n"))) {
             end_of_header += 2;
             found_header = 1;