<<< Date Index >>>     <<< Thread Index >>>

Re: pgp-auto-decode patch



On Wed, May 26, 2004 at 01:43:10PM +0200, Christoph Berg wrote:
> I noticed that the patch broke with CVS some weeks ago but didn't have
> the time yet to look at it. Could you post your half-working version
> here so we have a chance to continue with that? I'd be interested to
> look into it. (I don't promise that this will happen anytime soon,
> though.)

Yep.  Attached.  It's probably something simple, but I spent zero time
looking into it, and I really just don't want to.  In its current
state, the patch works fine so long as you're not doing a tag-
operation.  With tag- operations, it segfaults.

FWIW, there really is a demand for this functionality, albeit not
necessarily a huge one.  I reveiwed my server logs for the last month
(which is as far back as I keep them), and I had about 100 downloads
of the various versions of this patch, about half of which I'd
estimate to be from legitimate users (whereas the rest are just web
crawls)...

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail.  Sorry for the inconvenience.  Thank the spammers.

diff -u mutt/commands.c mutt.ddm/commands.c
--- mutt/commands.c     2004-04-13 05:33:33.000000000 +0900
+++ mutt.ddm/commands.c 2004-05-05 15:15:45.000000000 +0900
@@ -953,6 +953,7 @@
     rv = 1;
   }
   
+  h->security |= PGP_TRADITIONAL_CHECKED;
   mx_close_message (&msg);
   return rv;
 }
diff -u mutt/curs_main.c mutt.ddm/curs_main.c
--- mutt/curs_main.c    2004-04-13 05:33:33.000000000 +0900
+++ mutt.ddm/curs_main.c        2004-05-05 15:27:16.000000000 +0900
@@ -1114,7 +1114,7 @@
       case OP_DISPLAY_HEADERS: /* don't weed the headers */
 
        CHECK_MSGCOUNT;
-        CHECK_VISIBLE;
+       CHECK_VISIBLE;
        /*
         * toggle the weeding of headers so that a user can press the key
         * again while reading the message.
@@ -1132,6 +1132,8 @@
            menu->current = mutt_thread_next_unread (Context, CURHDR);
        }
  
+       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & 
PGP_TRADITIONAL_CHECKED))) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
        if ((op = mutt_display_message (CURHDR)) == -1)
        {
          unset_option (OPTNEEDRESORT);
@@ -1808,6 +1810,8 @@
 CHECK_IMAP_ACL(IMAP_ACL_INSERT);
 #endif
 
+       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & 
PGP_TRADITIONAL_CHECKED))) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
         mutt_edit_message (Context, tag ? NULL : CURHDR);
        menu->redraw = REDRAW_FULL;
 
@@ -1818,6 +1822,8 @@
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
        CHECK_ATTACH;
+       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & 
PGP_TRADITIONAL_CHECKED))) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
        ci_send_message (SENDFORWARD, NULL, NULL, Context, tag ? NULL : CURHDR);
        menu->redraw = REDRAW_FULL;
        break;
@@ -1832,6 +1838,8 @@
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
        CHECK_ATTACH;
+       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & 
PGP_TRADITIONAL_CHECKED))) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
        ci_send_message (SENDREPLY|SENDGROUPREPLY, NULL, NULL, Context, tag ? 
NULL : CURHDR);
        menu->redraw = REDRAW_FULL;
        break;
@@ -1841,6 +1849,8 @@
        CHECK_ATTACH;
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
+       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & 
PGP_TRADITIONAL_CHECKED))) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
        ci_send_message (SENDREPLY|SENDLISTREPLY, NULL, NULL, Context, tag ? 
NULL : CURHDR);
        menu->redraw = REDRAW_FULL;
        break;
@@ -1959,6 +1969,8 @@
        CHECK_ATTACH;
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
+       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & 
PGP_TRADITIONAL_CHECKED))) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
        ci_send_message (SENDREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
        menu->redraw = REDRAW_FULL;
        break;
diff -u mutt/init.h mutt.ddm/init.h
--- mutt/init.h 2004-04-13 17:02:12.000000000 +0900
+++ mutt.ddm/init.h     2004-05-05 15:15:45.000000000 +0900
@@ -1480,6 +1480,17 @@
   ** \fBdeprecated\fP.
   ** (PGP only)
   */
+  { "pgp_auto_decode", DT_BOOL, R_NONE, OPTPGPAUTODEC, 0 },
+  /*
+  ** .pp
+  ** If set, mutt will automatically attempt to decrypt traditional PGP
+  ** messages whenever the user performs an operation which ordinarily would
+  ** result in the contents of the message being operated on.  For example,
+  ** if the user displays a pgp-traditional message which has not been manually
+  ** checked with the check-traditional-pgp function, mutt will automatically
+  ** check the message for traditional pgp.
+  */
+
 
   /* XXX Default values! */
   
diff -u mutt/mutt.h mutt.ddm/mutt.h
--- mutt/mutt.h 2004-04-13 17:02:12.000000000 +0900
+++ mutt.ddm/mutt.h     2004-05-05 15:16:13.000000000 +0900
@@ -445,6 +445,7 @@
   OPTPGPIGNORESUB,
   OPTPGPCHECKEXIT,
   OPTPGPLONGIDS,
+  OPTPGPAUTODEC,
 #if 0
   OPTPGPENCRYPTSELF,
 #endif