2008-08-28 [colin] 3.5.0cvs78
authorColin Leroy <colin@colino.net>
Thu, 28 Aug 2008 13:09:09 +0000 (13:09 +0000)
committerColin Leroy <colin@colino.net>
Thu, 28 Aug 2008 13:09:09 +0000 (13:09 +0000)
* src/Makefile.am
* src/account.c
* src/compose.c
* src/prefs_account.c
* src/prefs_account.h
* src/privacy.c
* src/privacy.h
* src/procmime.c
* src/stock_pixmap.c
* src/stock_pixmap.h
* src/summaryview.c
* src/pixmaps/key_gpg_signed.xpm
Fix bug 1412, "Sign reply, if mail was signed"
Add an account preference to sign replies to signed mails

15 files changed:
ChangeLog
PATCHSETS
configure.ac
src/Makefile.am
src/account.c
src/compose.c
src/pixmaps/key_gpg_signed.xpm [new file with mode: 0644]
src/prefs_account.c
src/prefs_account.h
src/privacy.c
src/privacy.h
src/procmime.c
src/stock_pixmap.c
src/stock_pixmap.h
src/summaryview.c

index aa30f4a..6adee96 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-08-28 [colin]     3.5.0cvs78
+
+       * src/Makefile.am
+       * src/account.c
+       * src/compose.c
+       * src/prefs_account.c
+       * src/prefs_account.h
+       * src/privacy.c
+       * src/privacy.h
+       * src/procmime.c
+       * src/stock_pixmap.c
+       * src/stock_pixmap.h
+       * src/summaryview.c
+       * src/pixmaps/key_gpg_signed.xpm
+               Fix bug 1412, "Sign reply, if mail was signed"
+               Add an account preference to sign replies to signed mails
+
 2008-08-28 [iwkse]     3.5.0cvs77
 
        * src/prefs_filtering.c
index bbcf201..c8c0d1c 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/gtk/gtkcmctree.c;  ) > 3.5.0cvs75.patchset
 ( cvs diff -u -r 1.115.2.202 -r 1.115.2.203 src/main.c;  ) > 3.5.0cvs76.patchset
 ( cvs diff -u -r 1.59.2.71 -r 1.59.2.72 src/prefs_filtering.c;  ) > 3.5.0cvs77.patchset
+( cvs diff -u -r 1.155.2.89 -r 1.155.2.90 src/Makefile.am;  cvs diff -u -r 1.61.2.81 -r 1.61.2.82 src/account.c;  cvs diff -u -r 1.382.2.470 -r 1.382.2.471 src/compose.c;  cvs diff -u -r 1.105.2.142 -r 1.105.2.143 src/prefs_account.c;  cvs diff -u -r 1.49.2.37 -r 1.49.2.38 src/prefs_account.h;  cvs diff -u -r 1.10.2.15 -r 1.10.2.16 src/privacy.c;  cvs diff -u -r 1.10.2.16 -r 1.10.2.17 src/privacy.h;  cvs diff -u -r 1.49.2.113 -r 1.49.2.114 src/procmime.c;  cvs diff -u -r 1.25.2.59 -r 1.25.2.60 src/stock_pixmap.c;  cvs diff -u -r 1.18.2.36 -r 1.18.2.37 src/stock_pixmap.h;  cvs diff -u -r 1.395.2.383 -r 1.395.2.384 src/summaryview.c;  diff -u /dev/null src/pixmaps/key_gpg_signed.xpm;  ) > 3.5.0cvs78.patchset
index 25b29c5..0a697a6 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=77
+EXTRA_VERSION=78
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 37d173f..2caaf25 100644 (file)
@@ -380,6 +380,7 @@ EXTRA_DIST = \
        pixmaps/insert_file.xpm \
        pixmaps/jpilot.xpm \
        pixmaps/key.xpm \
+       pixmaps/key_gpg_signed.xpm \
        pixmaps/ldap.xpm \
        pixmaps/linewrap.xpm \
        pixmaps/linewrapcurrent.xpm \
index 6da9c00..dd6db89 100644 (file)
@@ -992,6 +992,7 @@ static void account_clone(GtkWidget *widget, gpointer data)
         ACP_FASSIGN(default_encrypt);
        ACP_FASSIGN(default_encrypt_reply);
         ACP_FASSIGN(default_sign);
+       ACP_FASSIGN(default_sign_reply);
        ACP_FASSIGN(save_encrypted_as_clear_text);
        ACP_FASSIGN(encrypt_to_self);
        
index 5daa602..71cfb24 100644 (file)
@@ -1504,6 +1504,11 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
                compose_force_encryption(compose, account, FALSE);
        }
 
+       privacy_msginfo_get_signed_state(compose->replyinfo);
+       if (MSG_IS_SIGNED(compose->replyinfo->flags) && account->default_sign_reply) {
+               compose_force_signing(compose, account);
+       }
+
        SIGNAL_BLOCK(textbuf);
        
        if (account->auto_sig)
@@ -10558,6 +10563,7 @@ static void compose_reply_from_messageview_real(MessageView *msgview, GSList *ms
        GSList *new_msglist = NULL;
        MsgInfo *tmp_msginfo = NULL;
        gboolean originally_enc = FALSE;
+       gboolean originally_sig = FALSE;
        Compose *compose = NULL;
 
        g_return_if_fail(msgview != NULL);
@@ -10576,6 +10582,9 @@ static void compose_reply_from_messageview_real(MessageView *msgview, GSList *ms
                                new_msglist = g_slist_append(NULL, tmp_msginfo);
 
                                originally_enc = MSG_IS_ENCRYPTED(orig_msginfo->flags);
+                               privacy_msginfo_get_signed_state(orig_msginfo);
+                               originally_sig = MSG_IS_SIGNED(orig_msginfo->flags);
+
                                tmp_msginfo->folder = orig_msginfo->folder;
                                tmp_msginfo->msgnum = orig_msginfo->msgnum; 
                                if (orig_msginfo->tags)
@@ -10598,6 +10607,10 @@ static void compose_reply_from_messageview_real(MessageView *msgview, GSList *ms
                compose_force_encryption(compose, compose->account, FALSE);
        }
 
+       if (compose && originally_sig && compose->account->default_sign_reply) {
+               compose_force_signing(compose, compose->account);
+       }
+
        g_free(body);
 }
 
diff --git a/src/pixmaps/key_gpg_signed.xpm b/src/pixmaps/key_gpg_signed.xpm
new file mode 100644 (file)
index 0000000..4e13726
--- /dev/null
@@ -0,0 +1,34 @@
+/* XPM */
+static char * key_gpg_signed_xpm[] = {
+"11 12 19 1",
+"      c None",
+".     c #D39C0A",
+"+     c #E4AB0B",
+"@     c #DA7D25",
+"#     c #E4B600",
+"$     c #E96B00",
+"%     c #DA2D01",
+"&     c #E9AD00",
+"*     c #E94500",
+"=     c #B11E04",
+"-     c #E7BC01",
+";     c #E99400",
+">     c #E02F00",
+",     c #E9BD00",
+"'     c #E97800",
+")     c #040204",
+"!     c #E7C50E",
+"~     c #E9B802",
+"{     c #FCFE04",
+"           ",
+"      .+@  ",
+"      #$%  ",
+"      &*=  ",
+"     -;>   ",
+"     ,'))) ",
+"    !~){{{)",
+" ))))){{{{)",
+"){{{{{{{){)",
+" ){){){{{{)",
+"  ) ) ){{{)",
+"       ))) "};
index 025698a..c93eee3 100644 (file)
@@ -223,6 +223,7 @@ typedef struct PrivacyPage
        GtkWidget *default_encrypt_checkbtn;
        GtkWidget *default_encrypt_reply_checkbtn;
        GtkWidget *default_sign_checkbtn;
+       GtkWidget *default_sign_reply_checkbtn;
        GtkWidget *save_clear_text_checkbtn;
        GtkWidget *encrypt_to_self_checkbtn;
 } PrivacyPage;
@@ -656,6 +657,10 @@ static PrefParam privacy_param[] = {
         &privacy_page.default_sign_checkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
+       {"default_sign_reply", "TRUE", &tmp_ac_prefs.default_sign_reply, P_BOOL,
+        &privacy_page.default_sign_reply_checkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+
        {"save_clear_text", "FALSE", &tmp_ac_prefs.save_encrypted_as_clear_text, P_BOOL,
         &privacy_page.save_clear_text_checkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -888,6 +893,8 @@ static void privacy_system_activated(GtkWidget *combobox)
                        privacy_enabled);
        gtk_widget_set_sensitive (privacy_page.default_sign_checkbtn,
                        privacy_enabled);
+       gtk_widget_set_sensitive (privacy_page.default_sign_reply_checkbtn,
+                       privacy_enabled);
        gtk_widget_set_sensitive (privacy_page.encrypt_to_self_checkbtn,
                        privacy_enabled);
        gtk_widget_set_sensitive (privacy_page.save_clear_text_checkbtn, 
@@ -2142,6 +2149,7 @@ static void privacy_create_widget_func(PrefsPage * _page,
        GtkWidget *default_encrypt_checkbtn;
        GtkWidget *default_encrypt_reply_checkbtn;
        GtkWidget *default_sign_checkbtn;
+       GtkWidget *default_sign_reply_checkbtn;
        GtkWidget *save_clear_text_checkbtn;
        GtkWidget *encrypt_to_self_checkbtn;
 
@@ -2189,6 +2197,9 @@ static void privacy_create_widget_func(PrefsPage * _page,
                           _("Always sign messages"));
        PACK_CHECK_BUTTON (vbox2, default_encrypt_checkbtn,
                           _("Always encrypt messages"));
+       PACK_CHECK_BUTTON (vbox2, default_sign_reply_checkbtn,
+                          _("Always sign messages when replying to a "
+                            "signed message"));
        PACK_CHECK_BUTTON (vbox2, default_encrypt_reply_checkbtn,
                           _("Always encrypt messages when replying to an "
                             "encrypted message"));
@@ -2203,6 +2214,7 @@ static void privacy_create_widget_func(PrefsPage * _page,
        page->default_privacy_system = default_privacy_system;
        page->default_encrypt_checkbtn = default_encrypt_checkbtn;
        page->default_encrypt_reply_checkbtn = default_encrypt_reply_checkbtn;
+       page->default_sign_reply_checkbtn = default_sign_reply_checkbtn;
        page->default_sign_checkbtn    = default_sign_checkbtn;
        page->save_clear_text_checkbtn = save_clear_text_checkbtn;
        page->encrypt_to_self_checkbtn = encrypt_to_self_checkbtn;
index 54103d2..bb5edc4 100644 (file)
@@ -152,6 +152,7 @@ struct _PrefsAccount
        gboolean  default_encrypt;
        gboolean  default_encrypt_reply;
        gboolean  default_sign;
+       gboolean  default_sign_reply;
        gboolean  save_encrypted_as_clear_text;
        gboolean  encrypt_to_self;
 
index 9e9fc86..29038a4 100644 (file)
@@ -147,6 +147,28 @@ try_others:
        return FALSE;
 }
 
+static void msginfo_set_signed_flag(GNode *node, gpointer data)
+{
+       MsgInfo *msginfo = data;
+       MimeInfo *mimeinfo = node->data;
+       
+       if (privacy_mimeinfo_is_signed(mimeinfo)) {
+               procmsg_msginfo_set_flags(msginfo, 0, MSG_SIGNED);
+       }
+       if (privacy_mimeinfo_is_encrypted(mimeinfo)) {
+               procmsg_msginfo_set_flags(msginfo, 0, MSG_ENCRYPTED);
+       } else {
+               /* searching inside encrypted parts doesn't really make sense */
+               g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_signed_flag, msginfo);
+       }
+}
+
+void privacy_msginfo_get_signed_state(MsgInfo *msginfo)
+{
+       MimeInfo *mimeinfo = procmime_scan_message(msginfo);
+       g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_signed_flag, msginfo);
+}
+
 /**
  * Check the signature of a MimeInfo. privacy_mimeinfo_is_signed
  * should be called before otherwise it is done by this function.
index 4848f32..cf9aa9f 100644 (file)
@@ -43,6 +43,7 @@ void privacy_unregister_system                        (PrivacySystem *system);
 
 void privacy_free_privacydata                  (PrivacyData *);
 
+void privacy_msginfo_get_signed_state          (MsgInfo *);
 gboolean privacy_mimeinfo_is_signed            (MimeInfo *);
 gint privacy_mimeinfo_check_signature          (MimeInfo *);
 SignatureStatus privacy_mimeinfo_get_sig_status        (MimeInfo *);
index 5d4f219..016ae67 100644 (file)
@@ -841,6 +841,8 @@ FILE *procmime_get_first_encrypted_text_content(MsgInfo *msginfo)
        partinfo = mimeinfo;
        while (partinfo && partinfo->type != MIMETYPE_TEXT) {
                partinfo = procmime_mimeinfo_next(partinfo);
+               if (privacy_mimeinfo_is_signed(partinfo))
+                       procmsg_msginfo_set_flags(msginfo, 0, MSG_SIGNED);
        }
 
        if (partinfo)
index b99da95..69af460 100644 (file)
@@ -50,6 +50,7 @@
 #include "pixmaps/interface.xpm"
 #include "pixmaps/jpilot.xpm"
 #include "pixmaps/key.xpm"
+#include "pixmaps/key_gpg_signed.xpm"
 #include "pixmaps/ldap.xpm"
 #include "pixmaps/linewrap.xpm"
 #include "pixmaps/linewrapcurrent.xpm"
@@ -275,6 +276,7 @@ static StockPixmapData pixmaps[] =
        {interface_xpm                          , NULL, NULL, "interface", NULL},
        {jpilot_xpm                             , NULL, NULL, "jpilot", NULL},
        {key_xpm                                , NULL, NULL, "key", NULL},
+       {key_gpg_signed_xpm                     , NULL, NULL, "key_gpg_signed_xpm", NULL},
        {ldap_xpm                               , NULL, NULL, "ldap", NULL},
        {linewrapcurrent_xpm                    , NULL, NULL, "linewrapcurrent", NULL},
        {linewrap_xpm                           , NULL, NULL, "linewrap", NULL},
index 08b638a..c74c517 100644 (file)
@@ -71,6 +71,7 @@ typedef enum
        STOCK_PIXMAP_INTERFACE,
        STOCK_PIXMAP_JPILOT,
        STOCK_PIXMAP_KEY,
+       STOCK_PIXMAP_KEY_SIGN,
        STOCK_PIXMAP_LDAP,
        STOCK_PIXMAP_LINEWRAP_CURRENT,
        STOCK_PIXMAP_LINEWRAP_ALL,
index a32b510..a7ad9ee 100644 (file)
@@ -122,6 +122,8 @@ static GdkPixmap *keyxpm;
 static GdkBitmap *keyxpmmask;
 static GdkPixmap *clipkeyxpm;
 static GdkBitmap *clipkeyxpmmask;
+static GdkPixmap *keysignxpm;
+static GdkBitmap *keysignxpmmask;
 static GdkPixmap *gpgsignedxpm;
 static GdkBitmap *gpgsignedxpmmask;
 static GdkPixmap *clipgpgsignedxpm;
@@ -1101,6 +1103,8 @@ void summary_init(SummaryView *summaryview)
                         &watchthreadxpm, &watchthreadxpmmask);
        stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_KEY,
                         &clipkeyxpm, &clipkeyxpmmask);
+       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_KEY_SIGN,
+                        &keysignxpm, &keysignxpmmask);
        stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_KEY,
                         &keyxpm, &keyxpmmask);
        stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_GPG_SIGNED,
@@ -3870,8 +3874,13 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCMCTreeNode *row)
                gtk_cmctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
                                          clipgpgsignedxpm, clipgpgsignedxpmmask);
        } else if (MSG_IS_SIGNED(flags)) {
-               gtk_cmctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
-                                         gpgsignedxpm, gpgsignedxpmmask);
+               if (MSG_IS_ENCRYPTED(flags)) {
+                       gtk_cmctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
+                                         keysignxpm, keysignxpmmask);
+               } else {
+                       gtk_cmctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
+                                                 gpgsignedxpm, gpgsignedxpmmask);
+               }
        } else if (MSG_IS_WITH_ATTACHMENT(flags) && MSG_IS_ENCRYPTED(flags)) {
                gtk_cmctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
                                          clipkeyxpm, clipkeyxpmmask);
@@ -7513,6 +7522,7 @@ void summary_reflect_prefs_pixmap_theme(SummaryView *summaryview)
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_WATCHTHREAD, &watchthreadxpm, &watchthreadxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_CLIP_KEY, &clipkeyxpm, &clipkeyxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_KEY, &keyxpm, &keyxpmmask);
+       stock_pixmap_gdk(ctree, STOCK_PIXMAP_KEY_SIGN, &keysignxpm, &keysignxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_GPG_SIGNED, &gpgsignedxpm, &gpgsignedxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_CLIP_GPG_SIGNED, &clipgpgsignedxpm, &clipgpgsignedxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_SPAM, &spamxpm, &spamxpmmask);