Skip to content

Instantly share code, notes, and snippets.

@nicolasbock
Created November 3, 2016 15:57
Show Gist options
  • Save nicolasbock/c7349959eacdf16b8793215ba31b5a82 to your computer and use it in GitHub Desktop.
Save nicolasbock/c7349959eacdf16b8793215ba31b5a82 to your computer and use it in GitHub Desktop.
diff -Naur mutt-1.7.1-orig/crypt.c mutt-1.7.1/crypt.c
--- mutt-1.7.1-orig/crypt.c 2016-10-08 13:35:50.000000000 -0600
+++ mutt-1.7.1/crypt.c 2016-11-03 09:16:15.447959488 -0600
@@ -252,10 +252,22 @@
if ((WithCrypto & APPLICATION_PGP)
&& (msg->security & APPLICATION_PGP))
{
- if (!(pbody = crypt_pgp_encrypt_message (tmp_pgp_pbody, keylist,
- flags & SIGN)))
+ char *new_keylist = keylist;
+
+ if (PgpSignAs && query_quadoption (OPTPGPENCRYPTSELF, _("Encrypt message to PGP Default Key also?")) == MUTT_YES)
{
+ /* +1 for SPACE, +1 for NULL */
+ int size = mutt_strlen (keylist) + mutt_strlen (PgpSignAs) + 2;
+ new_keylist = safe_malloc (size);
+ snprintf (new_keylist, size, "%s %s", keylist, PgpSignAs);
+ }
+ pbody = crypt_pgp_encrypt_message (tmp_pgp_pbody, new_keylist,
+ flags & SIGN);
+ if (new_keylist != keylist)
+ FREE (&new_keylist);
+ if (!pbody)
+ {
/* did we perform a retainable signature? */
if (flags != msg->security)
{
diff -Naur mutt-1.7.1-orig/init.h mutt-1.7.1/init.h
--- mutt-1.7.1-orig/init.h 2016-10-08 13:35:50.000000000 -0600
+++ mutt-1.7.1/init.h 2016-11-03 09:14:16.812290553 -0600
@@ -554,6 +554,12 @@
** to find out whether an encrypted message is also signed.
** (Crypto only)
*/
+ { "pgp_encrypt_self", DT_QUAD, R_NONE, OPTPGPENCRYPTSELF, MUTT_NO },
+ /*
+ ** .pp
+ ** Encrypt the message to $$pgp_sign_as too.
+ ** (PGP only)
+ */
{ "crypt_timestamp", DT_BOOL, R_NONE, OPTCRYPTTIMESTAMP, 1 },
/*
** .pp
diff -Naur mutt-1.7.1-orig/mutt.h mutt-1.7.1/mutt.h
--- mutt-1.7.1-orig/mutt.h 2016-10-08 13:30:21.000000000 -0600
+++ mutt-1.7.1/mutt.h 2016-11-03 09:17:06.090246426 -0600
@@ -550,9 +550,7 @@
OPTPGPCHECKEXIT,
OPTPGPLONGIDS,
OPTPGPAUTODEC,
-#if 0
OPTPGPENCRYPTSELF,
-#endif
OPTPGPRETAINABLESIG,
OPTPGPSTRICTENC,
OPTFORWDECRYPT,
diff -Naur mutt-1.7.1-orig/muttrc.encrypt-to-self mutt-1.7.1/muttrc.encrypt-to-self
--- mutt-1.7.1-orig/muttrc.encrypt-to-self 1969-12-31 17:00:00.000000000 -0700
+++ mutt-1.7.1/muttrc.encrypt-to-self 2016-11-03 09:17:45.465470024 -0600
@@ -0,0 +1,13 @@
+# This is a complete list of encrypt-to-self-related configuration.
+
+# --------------------------------------------------------------------------
+# VARIABLES - shown with their default values
+# --------------------------------------------------------------------------
+
+# Save a copy of outgoing email, encrypted to yourself
+set smime_encrypt_self = "no"
+
+# Save a copy of outgoing email, encrypted to yourself
+set pgp_encrypt_self = "no"
+
+# vim: syntax=muttrc
diff -Naur mutt-1.7.1-orig/vimrc.encrypt-to-self mutt-1.7.1/vimrc.encrypt-to-self
--- mutt-1.7.1-orig/vimrc.encrypt-to-self 1969-12-31 17:00:00.000000000 -0700
+++ mutt-1.7.1/vimrc.encrypt-to-self 2016-11-03 09:17:47.865483666 -0600
@@ -0,0 +1,6 @@
+" Vim syntax file for the mutt encrypt-to-self patch
+
+syntax keyword muttrcVarQuad smime_encrypt_self
+syntax keyword muttrcVarQuad pgp_encrypt_self
+
+" vim: syntax=vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment