shithub: Nail

Download patch

ref: 4ba5b6daa92b75a3ec8579e8de9025f02b71088e
parent: ed0a057803a11e12326211123433100647d6c8f9
author: Ori Bernstein <[email protected]>
date: Sat Nov 21 14:21:15 EST 2020

Don't double-show text bodies.

--- a/mesg.c
+++ b/mesg.c
@@ -266,15 +266,15 @@
 		Bprint(wfd, "\n");
 	for(i = 0; i < m->nparts; i++){
 		a = m->parts[i];
-		if(a == m)
-			continue;
 		name = a->name;
 		if(strncmp(a->name, m->name, strlen(m->name)) == 0)
 			name += strlen(m->name);
-		Bprint(wfd, "\n===> %s (%s)\n", name, a->type);
 		if(a->disposition != nil
 		&& strcmp(a->disposition, "inline") == 0
 		&& strcmp(a->type, "text/plain") == 0){
+			if(a == m || a == m->body)
+				continue;
+			Bprint(wfd, "\n===> %s (%s)\n", name, a->type);
 			path = estrjoin(mbox.path, a->name, "body", nil);
 			if((rfd = Bopen(path, OREAD)) != nil){
 				copy(wfd, rfd);
@@ -283,6 +283,7 @@
 			free(path);
 			continue;
 		}
+		Bprint(wfd, "\n===> %s (%s)\n", name, a->type);
 		name = a->filename;
 		if(name == nil)
 			name = "body";
@@ -422,7 +423,7 @@
 		case 'x':
 		case 'X':
 			if((nf = tokenize(ev.text, f, nelem(f))) == 0)
-				continue;//
+				continue;
 			for(p = mesgfn; p->fn != nil; p++){
 				if(strcmp(p->name, f[0]) == 0 && p->fn != nil){
 					p->fn(m, &f[1], nf - 1);