about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--blaze822.h2
-rw-r--r--rfc2045.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/blaze822.h b/blaze822.h
index f39cf78..a969aaa 100644
--- a/blaze822.h
+++ b/blaze822.h
@@ -30,5 +30,5 @@ int blaze822_decode_b64(char *start, char *stop, char **deco, size_t *decleno);
 // rfc2045.c
 
 int blaze822_check_mime(struct message *msg);
-int blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno);
+int blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno, char **bodychunko);
 int blaze822_multipart(struct message *msg, struct message **imsg);
diff --git a/rfc2045.c b/rfc2045.c
index 8f913a1..e5e19ff 100644
--- a/rfc2045.c
+++ b/rfc2045.c
@@ -16,7 +16,8 @@ blaze822_check_mime(struct message *msg)
 }
 
 int
-blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno)
+blaze822_mime_body(struct message *msg,
+    char **cto, char **bodyo, size_t *bodyleno, char **bodychunko)
 {
 	if (!msg->body || !msg->bodyend) {
 		*bodyo = 0;
@@ -37,16 +38,20 @@ blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyle
 	*cto = ct;
 
 	if (cte) {
-		if (strncasecmp(cte, "quoted-printable", 16) == 0)
+		if (strncasecmp(cte, "quoted-printable", 16) == 0) {
 			blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno);
-		else if (strncasecmp(cte, "base64", 6) == 0)
+			*bodychunko = *bodyo;
+		} else if (strncasecmp(cte, "base64", 6) == 0) {
 			blaze822_decode_b64(msg->body, msg->bodyend, bodyo, bodyleno);
-		else
+			*bodychunko = *bodyo;
+		} else {
 			cte = 0;
+		}
 	}
 	if (!cte) {
 		*bodyo = msg->body;
 		*bodyleno = msg->bodyend - msg->body;
+		*bodychunko = 0;
 	}
 
 	return 1;