9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] nedmail: only display most useful headers
@ 2024-02-06 14:41 phil9
  2024-02-06 17:14 ` umbraticus
  2024-02-06 18:07 ` unobe
  0 siblings, 2 replies; 11+ messages in thread
From: phil9 @ 2024-02-06 14:41 UTC (permalink / raw)
  To: 9front

Hi,

Below patch limits the headers displayed by nedmail to the most "useful"
ones:Date, From, To, CC (is set) and Subject.
This helps with some mailing lists or mail providers adding loads of noisy headers.
This only applies to the 'p' command and all headers are still visible
when using the 'P' (display raw) command so nothing is lost.

cheers
--phil


diff 081b58a69e5efc2bbf49ee31099372527edb3fa7 uncommitted
--- a/sys/src/cmd/upas/ned/nedmail.c
+++ b/sys/src/cmd/upas/ned/nedmail.c
@@ -1664,6 +1664,18 @@
 	return c;
 }
 
+void
+printheaders(Message *m)
+{
+	Bprint(&out, "Date: %s\n", m->date);
+	Bprint(&out, "From: %s\n", m->from);
+	Bprint(&out, "To: %s\n", m->to);
+	if(strlen(m->cc)>0)
+		Bprint(&out, "CC: %s\n", m->cc);
+	Bprint(&out, "Subject: %s\n", m->subject);
+	Bprint(&out, "\n");
+}
+
 Message*
 pcmd0(Cmd *c, Message *m, int mayplumb, char *tfmt)
 {
@@ -1684,10 +1696,9 @@
 	}
 	if(m->parent == &top){
 		seen(m);
-		printpart(m, "unixheader", nil);
+		/* only print headers for top part */
+		printheaders(m);
 	}
-	if(printpart(m, "header", nil) > 0)
-		Bprint(&out, "\n");
 	cp = findctype(m);
 	if(cp->flag & Display){
 		if(strcmp(m->type, "text/html") == 0)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-07 17:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06 14:41 [9front] [PATCH] nedmail: only display most useful headers phil9
2024-02-06 17:14 ` umbraticus
2024-02-06 17:17   ` ori
2024-02-06 17:38   ` phil9
2024-02-07  4:23     ` umbraticus
2024-02-07  6:06       ` phil9
2024-02-07  6:54         ` chris
2024-02-07  9:03           ` umbraticus
2024-02-07 12:25             ` chris
2024-02-07 17:37               ` umbraticus
2024-02-06 18:07 ` unobe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).