about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--blaze822.h2
-rw-r--r--rfc2045.c2
-rw-r--r--rfc2047.c6
3 files changed, 5 insertions, 5 deletions
diff --git a/blaze822.h b/blaze822.h
index f466779..053ef0a 100644
--- a/blaze822.h
+++ b/blaze822.h
@@ -31,7 +31,7 @@ char *blaze822_orig_header(struct message *mesg);
 // rfc2047.c
 
 int blaze822_decode_rfc2047(char *, char *, size_t, char *);
-int blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno);
+int blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno, int underscore);
 int blaze822_decode_b64(char *start, char *stop, char **deco, size_t *decleno);
 
 // rfc2045.c
diff --git a/rfc2045.c b/rfc2045.c
index 9ee4e85..fec445d 100644
--- a/rfc2045.c
+++ b/rfc2045.c
@@ -53,7 +53,7 @@ blaze822_mime_body(struct message *msg,
 
 	if (cte) {
 		if (strncasecmp(cte, "quoted-printable", 16) == 0) {
-			blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno);
+			blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno, 0);
 			*bodychunko = *bodyo;
 		} else if (strncasecmp(cte, "base64", 6) == 0) {
 			blaze822_decode_b64(msg->body, msg->bodyend, bodyo, bodyleno);
diff --git a/rfc2047.c b/rfc2047.c
index b3782fb..6f23d10 100644
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -11,7 +11,7 @@
 // XXX keep trying bytewise on invalid iconv
 
 int
-blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno)
+blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno, int underscore)
 {
 	static signed char hex[] = {
 		-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
@@ -47,7 +47,7 @@ blaze822_decode_qp(char *start, char *stop, char **deco, size_t *decleno)
 				continue;
 			}
 			*buf++ = (hex[c1] << 4) | hex[c2];
-		} else if (*s == '_') {
+		} else if (underscore && *s == '_') {
 			*buf++ = ' ';
 			s++;
 		} else {
@@ -191,7 +191,7 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
 		char *dec = 0, *decchunk;
 		size_t declen = 0;
 		if (enc == 'q')
-			blaze822_decode_qp(start, stop, &dec, &declen);
+			blaze822_decode_qp(start, stop, &dec, &declen, 1);
 		else if (enc == 'b')
 			blaze822_decode_b64(start, stop, &dec, &declen);
 		else