shithub: Nail

Download patch

ref: fa197540ea4e5adc7e8875bd3ca8f080b46a3b4f
parent: 154fcdbc15a25742bf471ebba54c90f0c1228231
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Feb 1 23:39:46 EST 2021

Mail: only clear upas-maintained flags on change (thanks deuteron)

When message flags change, Mail would clear all the flags and
recompute them. This would clobber internal flags like Ftodel.
So, don't do that.

--- a/mbox.c
+++ b/mbox.c
@@ -26,7 +26,7 @@
 
 char	*maildir	= "/mail/fs";
 char	*mailbox	= "mbox";
-char	*savebox	= nil;
+char	*savebox	= "outgoing";
 char	*listfmt	= "%>48s\t<%f>";
 Mesg	dead = {.messageid="", .hash=42};
 
@@ -321,7 +321,7 @@
 		return nil;
 	free(m->mflags);
 	m->mflags = f;
-	m->flags = 0;
+	m->flags &= ~(Fdel|Fseen|Fresp);
 	if(strchr(m->mflags, 'd')) m->flags |= Fdel;
 	if(strchr(m->mflags, 's')) m->flags |= Fseen;
 	if(strchr(m->mflags, 'a')) m->flags |= Fresp;
@@ -797,7 +797,6 @@
 
 	digest = plumblookup(pm->attr, "digest");
 	action = plumblookup(pm->attr, "mailtype");
-//	fprint(2, "changing message %s, %s %s\n", action, pm->data, digest);
 	if(strcmp(action, "new") == 0){
 		if((m = load(pm->data, digest, 1)) == nil)
 			return;
@@ -1011,6 +1010,9 @@
 		break;
 	case 'f':
 		listfmt = EARGF(usage());
+		break;
+	case 'O':
+		savebox = nil;
 		break;
 	case 'o':
 		savebox = EARGF(usage());
--- a/mesg.c
+++ b/mesg.c
@@ -300,7 +300,7 @@
 static void
 reply(Mesg *m, char **f, int nf)
 {
-	if(nf >= 1 &&  strcmp(f[0], "all") != 0)
+	if(nf >= 1 &&  strcmp(f[0], "all") == 0)
 		compose(m->replyto, m, 1);
 	else
 		compose(m->replyto, m, 0);