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

Re: How to send mail with a sign gpg in attachment like



* Dongsheng Song [15.Şub.08 20:50 +0800]:
> Alex, your mutt not sign in attachment like signature.asc:
> 
> Content-Type: application/pgp-signature
> Content-Disposition: inline

This is the default mutt behavior.

> But Joseph's mutt is right:
> Content-Type: application/pgp-signature; name="signature.asc"
> Content-Description: Digital signature
> Content-Disposition: inline

He appears to be using a debian patch. But I guess that patch is broken
in the way it adds those extra parameters for non-ascii values of the
pgp_mime_signature_description setting.

> I'm expected: Content-Type: application/pgp-signature;
> name="signature.asc" Content-Description: GnuPG digital signature
> Content-Disposition: attachment; filename="signature.asc"
> 
> Joseph, How to set 'name="signature.asc"' ? 
> Could you give me a sample ?

I don't know why you need to set the disposition to "attachment" instead
of "inline". If you just need to lookout for correspondents with
clueless mail readers, try the attached patch I'm using. I wonder why
this feature does not exist in in vanilla mutt.

-- 
~sertaç
diff -Nurp mutt-1.5.16/crypt-gpgme.c mutt-1.5.16-new/crypt-gpgme.c
--- mutt-1.5.16/crypt-gpgme.c   2007-08-21 23:49:34.000000000 +0300
+++ mutt-1.5.16-new/crypt-gpgme.c       2007-08-21 23:57:24.000000000 +0300
@@ -34,6 +34,7 @@
 #include "copy.h"
 #include "pager.h"
 #include "sort.h"
+#include "rfc2047.h" /* for content-description */
 
 #include <sys/wait.h>
 #include <string.h>
@@ -894,6 +893,8 @@ static BODY *sign_message (BODY *a, int 
       t->use_disp = 1;
       t->disposition = DISPATTACH;
       t->d_filename = safe_strdup ("smime.p7s");
+      t->description = safe_strdup (_("Digital Signature"));
+      rfc2047_encode_string (&t->description);
     }
   else
     {
@@ -901,6 +902,9 @@ static BODY *sign_message (BODY *a, int 
       t->use_disp = 0;
       t->disposition = DISPINLINE;
       t->encoding = ENC7BIT;
+      t->description = safe_strdup (_("Digital Signature"));
+      rfc2047_encode_string (&t->description);
+      mutt_set_parameter ("name", "signature.asc", &t->parameter);
     }
   t->filename = sigfile;
   t->unlink = 1; /* ok to remove this file after sending. */
diff -Nurp mutt-1.5.16/pgp.c mutt-1.5.16-new/pgp.c
--- mutt-1.5.16/pgp.c   2007-04-21 23:02:39.000000000 +0300
+++ mutt-1.5.16-new/pgp.c       2007-08-21 23:55:10.000000000 +0300
@@ -35,6 +35,7 @@
 #include "pgp.h"
 #include "mime.h"
 #include "copy.h"
+#include "rfc2047.h" /* for content-description */
 
 #include <sys/wait.h>
 #include <string.h>
@@ -1107,6 +1107,9 @@ BODY *pgp_sign_message (BODY *a)
   t->use_disp = 0;
   t->disposition = DISPINLINE;
   t->encoding = ENC7BIT;
+  t->description = safe_strdup (_("Digital Signature"));
+  rfc2047_encode_string (&t->description);
+  mutt_set_parameter ("name", "signature.asc", &t->parameter);
   t->unlink = 1; /* ok to remove this file after sending. */
 
   return (a);
--- mutt-orig/PATCHES   2007-08-21 22:58:29.000000000 +0300
+++ mutt/PATCHES        1970-01-01 02:00:00.000000000 +0200
@@ -0,0 +1 @@
+sy.mime_signature_parameters