9front - general discussion about 9front
 help / color / mirror / Atom feed
From: phil9 <telephil9@gmail.com>
To: 9front@9front.org
Subject: [9front] [PATCH] nedmail: only display most useful headers
Date: Tue, 6 Feb 2024 15:41:53 +0100	[thread overview]
Message-ID: <ZcJFMZkRHkvv46oJ@gmail.com> (raw)

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)


             reply	other threads:[~2024-02-06 14:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 14:41 phil9 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZcJFMZkRHkvv46oJ@gmail.com \
    --to=telephil9@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).