nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] pick(1) decode RFC-2047 headers?


From: David Levine
Subject: Re: [Nmh-workers] pick(1) decode RFC-2047 headers?
Date: Sat, 24 Nov 2012 16:47:39 -0600

Ken wrote:

> Hrm.  As I read it this will also try to decode the body of a
> message, right?  Not sure if that's a good idea.  Fixing that might
> require some more surgery to pick, though.

pick quits once it reaches the body, except with -search,
so not a problem:

  if (body && n->n_header)
      return 0;

With -search, it will try to decode and fail, but I don't
think that's worth inhibiting.  It would be nice to decode
message parts, some day.

decode_rfc2047() returns zero if it failed to decode anything,
so we can rely on that instead of trying to determine in advance
whether to call it.

David


diff --git a/uip/picksbr.c b/uip/picksbr.c
index 4895b23..b3fac9c 100644
--- a/uip/picksbr.c
+++ b/uip/picksbr.c
@@ -78,6 +78,7 @@ static struct swit parswit[] = {
 
 
 static char linebuf[LBSIZE + 1];
+static char decoded_linebuf[LBSIZE + 1];
 
 /* the magic array for case-independence */
 static unsigned char cc[] = {
@@ -714,6 +715,11 @@ plist
        p1 = linebuf;
        p2 = n->n_expbuf;
 
+       /* Attempt to decode as a MIME header. */
+       if (decode_rfc2047 (linebuf, decoded_linebuf, sizeof decoded_linebuf)) {
+           p1 = decoded_linebuf;
+       }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]