@matheusbsbs / matheus-bagliano / commits / 3350453014
Fork 0

Move B and Q decoding into check header.

B and Q decoding is not appropriate for in body headers, so move it up to where we explicitly know we have a real email header. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Eric W. Biederman committed May 23, 2006 at 13:45 UTC 3350453014324e375cdca722b50e93cdd78894ed
1 file changed +5 -7
mailinfo.c
+5 -7
@@ -324,6 +324,7 @@ static void cleanup_space(char *buf)
324 }
325 }
326
327 +static void decode_header_bq(char *it);
328 typedef int (*header_fn_t)(char *);
329 struct header_def {
330 const char *name;
@@ -343,6 +344,10 @@ static void check_header(char *line, struct header_def *header)
344 int len = header[i].namelen;
345 if (!strncasecmp(line, header[i].name, len) &&
346 line[len] == ':' && isspace(line[len + 1])) {
347 + /* Unwrap inline B and Q encoding, and optionally
348 + * normalize the meta information to utf8.
349 + */
350 + decode_header_bq(line + len + 2);
351 header[i].func(line + len + 2);
352 break;
353 }
@@ -597,13 +602,6 @@ static void handle_info(void)
602 cleanup_space(email);
603 cleanup_space(sub);
604
600 - /* Unwrap inline B and Q encoding, and optionally
601 - * normalize the meta information to utf8.
602 - */
603 - decode_header_bq(name);
604 - decode_header_bq(date);
605 - decode_header_bq(email);
606 - decode_header_bq(sub);
605 printf("Author: %s\nEmail: %s\nSubject: %s\nDate: %s\n\n",
606 name, email, sub, date);
607 }