enable ascii-armored gpg messages
authorPaul Mangan <paul@claws-mail.org>
Fri, 12 Oct 2001 11:39:02 +0000 (11:39 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 12 Oct 2001 11:39:02 +0000 (11:39 +0000)
AUTHORS
ChangeLog.claws
configure.in
src/prefs_common.c
src/prefs_common.h
src/rfc2015.c

diff --git a/AUTHORS b/AUTHORS
index 97d61e7..510c2fc 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -83,3 +83,4 @@ contributors (beside the above; based on Changelog)
        Paul Evans
        wwp
        Jeroen Versteeg
+       Ravemax
index 5669bd8..60f76e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-10-12 [paul]      0.6.3claws11
+
+       * src/prefs_common.[ch], src/rfc2015.c
+               enable ascii-armored gpg text to be embedded in the
+               message body, selectable through the 'Privacy'
+               preferences. Supports encrypting only.
+               Submitted by Ravemax <ravemax@dextrose.com>
+
 2001-10-12 [paul]      0.6.3claws10
 
        * sync with sylpheed 0.6.3cvs6
index 4b0fce2..c631aff 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws10
+EXTRA_VERSION=claws11
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 3d57841..9c1c962 100644 (file)
@@ -169,6 +169,7 @@ static struct Message {
 #if USE_GPGME
 static struct Privacy {
        GtkWidget *checkbtn_default_encrypt;
+    GtkWidget *checkbtn_ascii_armored;
        GtkWidget *checkbtn_default_sign;
        GtkWidget *checkbtn_auto_check_signatures;
        GtkWidget *checkbtn_gpg_signature_popup;
@@ -220,6 +221,8 @@ static void prefs_common_charset_set_optmenu              (PrefParam *pparam);
 static void prefs_common_default_signkey_set_data_from_optmenu
                                                        (PrefParam *pparam);
 static void prefs_common_default_signkey_set_optmenu   (PrefParam *pparam);
+static void prefs_common_ascii_armored_warning(GtkWidget* widget, 
+                                                                                               gpointer unused);
 #endif
 static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam);
 static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam);
@@ -565,6 +568,9 @@ static PrefParam param[] = {
        {"default_encrypt", "FALSE", &prefs_common.default_encrypt, P_BOOL,
         &privacy.checkbtn_default_encrypt,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       {"ascii_armored", "FALSE", &prefs_common.ascii_armored, P_BOOL,
+        &privacy.checkbtn_ascii_armored,
+        prefs_set_data_from_toggle, prefs_set_toggle},
        {"default_sign", "FALSE", &prefs_common.default_sign, P_BOOL,
         &privacy.checkbtn_default_sign,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -1915,6 +1921,7 @@ static void prefs_privacy_create(void)
        GtkWidget *vbox2;
        GtkWidget *hbox1;
        GtkWidget *checkbtn_default_encrypt;
+    GtkWidget *checkbtn_ascii_armored;
        GtkWidget *checkbtn_default_sign;
        GtkWidget *checkbtn_auto_check_signatures;
        GtkWidget *checkbtn_gpg_signature_popup;
@@ -1937,6 +1944,11 @@ static void prefs_privacy_create(void)
        PACK_CHECK_BUTTON (vbox2, checkbtn_default_encrypt,
                           _("Encrypt message by default"));
 
+       PACK_CHECK_BUTTON (vbox2, checkbtn_ascii_armored,
+                          _("Plain ASCII armored"));
+       gtk_signal_connect(GTK_OBJECT(checkbtn_ascii_armored), "toggled",
+                               prefs_common_ascii_armored_warning, (gpointer)0);
+
        PACK_CHECK_BUTTON (vbox2, checkbtn_default_sign,
                           _("Sign message by default"));
 
@@ -1975,6 +1987,7 @@ static void prefs_privacy_create(void)
        gtk_widget_set_sensitive(optmenu, FALSE);
 
        privacy.checkbtn_default_encrypt = checkbtn_default_encrypt;
+    privacy.checkbtn_ascii_armored = checkbtn_ascii_armored;
        privacy.checkbtn_default_sign    = checkbtn_default_sign;
        privacy.checkbtn_auto_check_signatures
                                         = checkbtn_auto_check_signatures;
@@ -2030,6 +2043,18 @@ static void prefs_common_default_signkey_set_optmenu(PrefParam *pparam)
        prefs_common_charset_set_data_from_optmenu(pparam);
 #endif
 }
+
+static void prefs_common_ascii_armored_warning(GtkWidget* widget,
+                                                                                               gpointer unused)
+{
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))
+               && gtk_notebook_get_current_page(GTK_NOTEBOOK(dialog.notebook))) {
+               alertpanel_message("Warning - Privacy/Plain ASCII armored",
+                       "Its not recommend to use the old style plain ASCII\n"
+                       "armored mode for encypted messages. It doesn't comply\n"
+                       "with the RFC 3156 - MIME security with OpenPGP.");
+       }
+}
 #endif /* USE_GPGME */
 
 static void prefs_interface_create(void)
index d585c98..c1766e6 100644 (file)
@@ -192,6 +192,7 @@ struct _PrefsCommon
 
        /* Privacy */
        gboolean default_encrypt;
+       gboolean ascii_armored;
        gboolean default_sign;
        gboolean auto_check_signatures;
        gboolean gpg_signature_popup;
index ec7c2ed..713f027 100644 (file)
@@ -822,20 +822,27 @@ rfc2015_encrypt (const char *file, GSList *recp_list)
     if (!mime_version_seen) 
         fputs ("MIME-Version: 1\r\n", fp);
 
-    fprintf (fp,
-            "Content-Type: multipart/encrypted;"
-            " protocol=\"application/pgp-encrypted\";\r\n"
-            " boundary=\"%s\"\r\n"
-            "\r\n"
-            "--%s\r\n"
-            "Content-Type: application/pgp-encrypted\r\n"
-            "\r\n"
-            "Version: 1\r\n"
-            "\r\n"
-            "--%s\r\n"
-            "Content-Type: application/octet-stream\r\n"
-            "\r\n",
-            boundary, boundary, boundary);
+    if (prefs_common.ascii_armored) {
+        fprintf(fp, 
+            "Content-Type: text/plain; charset=us-ascii\r\n"
+            "Content-Transfer-Encoding: 7bit\r\n"  
+            "\r\n");
+    } else {
+        fprintf (fp,
+               "Content-Type: multipart/encrypted;"
+               " protocol=\"application/pgp-encrypted\";\r\n"
+               " boundary=\"%s\"\r\n"
+               "\r\n"
+               "--%s\r\n"
+               "Content-Type: application/pgp-encrypted\r\n"
+               "\r\n"
+               "Version: 1\r\n"
+               "\r\n"
+               "--%s\r\n"
+               "Content-Type: application/octet-stream\r\n"
+               "\r\n",
+               boundary, boundary, boundary);
+    }
 
     /* append the encrypted stuff */
     err = gpgme_data_rewind (cipher);
@@ -854,11 +861,13 @@ rfc2015_encrypt (const char *file, GSList *recp_list)
     }
 
     /* and the final boundary */
-    fprintf (fp,
-            "\r\n"
-            "--%s--\r\n"
-            "\r\n",
-            boundary);
+    if (!prefs_common.ascii_armored) {
+        fprintf (fp,
+               "\r\n"
+               "--%s--\r\n"
+               "\r\n",
+            boundary);
+    }
     fflush (fp);
     if (ferror (fp)) {
         FILE_OP_ERROR (file, "fwrite");