[Commits] [SCM] claws branch, master, updated. 3.9.2-33-ge84ba2d

colin at claws-mail.org colin at claws-mail.org
Thu Jul 25 13:27:27 CEST 2013


The branch master of project "claws" (Claws Mail) has been updated
       via  e84ba2db17ea9afcb3b14e5a3d5a350e63b5cf2f (commit)
      from  7aa5fcbf3d01efdc5fb9afe795b295d138f84f5c (commit)


- Log -----------------------------------------------------------------
commit e84ba2db17ea9afcb3b14e5a3d5a350e63b5cf2f
Author: Colin Leroy <colin at colino.net>
Date:   Thu Jul 25 13:26:24 2013 +0200

    Make signature auto-check not blocking.

diff --git a/src/mimeview.c b/src/mimeview.c
index c9c1fbc..64bbdd9 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -1094,6 +1094,9 @@ static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo,
 		(gpointer) mimeview);
 	noticeview_set_icon(mimeview->siginfoview, icon);
 	noticeview_set_tooltip(mimeview->siginfoview, button_text);
+
+	icon_list_clear(mimeview);
+	icon_list_create(mimeview, mimeview->mimeinfo);
 }
 
 #ifdef USE_PTHREAD
@@ -1172,9 +1175,7 @@ static gboolean mimeview_check_sig_thread_cb(void *data)
 	else
 		update_signature_noticeview(mimeview, mimeview->siginfo, 
 			FALSE, 0);
-	icon_list_clear(mimeview);
-	icon_list_create(mimeview, mimeview->mimeinfo);
-	
+
 end:
 	mimeview_check_data_reset(mimeview);
 	return FALSE;
@@ -1329,8 +1330,6 @@ static void check_signature_cb(GtkWidget *widget, gpointer user_data)
 		debug_print("checking without thread\n");
 		privacy_mimeinfo_check_signature(mimeinfo);
 		update_signature_noticeview(mimeview, mimeview->siginfo, FALSE, 0);
-		icon_list_clear(mimeview);
-		icon_list_create(mimeview, mimeview->mimeinfo);
 	}
 }
 
@@ -1462,6 +1461,10 @@ static void mimeview_selected(GtkTreeSelection *selection, MimeView *mimeview)
 			break;
 		}
 	}
+
+	if (mimeview->siginfo && privacy_auto_check_signatures(mimeview->siginfo)) {
+		mimeview_check_signature(mimeview);
+	}
 }
 
 static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
diff --git a/src/plugins/pgpcore/prefs_gpg.c b/src/plugins/pgpcore/prefs_gpg.c
index 5a95799..acdd714 100644
--- a/src/plugins/pgpcore/prefs_gpg.c
+++ b/src/plugins/pgpcore/prefs_gpg.c
@@ -650,3 +650,8 @@ void prefs_gpg_remove_skip_encryption_warning(const gchar *systemid)
 	}
 	prefs_gpg_save_config();
 }
+
+gboolean prefs_gpg_auto_check_signatures(void)
+{
+	return prefs_gpg_get_config()->auto_check_signatures;
+}
diff --git a/src/plugins/pgpcore/prefs_gpg.h b/src/plugins/pgpcore/prefs_gpg.h
index c9344e7..422b7d6 100644
--- a/src/plugins/pgpcore/prefs_gpg.h
+++ b/src/plugins/pgpcore/prefs_gpg.h
@@ -57,3 +57,4 @@ void prefs_gpg_enable_agent(gboolean enable);
 void prefs_gpg_add_skip_encryption_warning(const gchar *systemid);
 void prefs_gpg_remove_skip_encryption_warning(const gchar *systemid);
 gboolean prefs_gpg_should_skip_encryption_warning(const gchar *systemid);
+gboolean prefs_gpg_auto_check_signatures(void);
diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c
index cbd3bb0..2a60946 100644
--- a/src/plugins/pgpinline/pgpinline.c
+++ b/src/plugins/pgpinline/pgpinline.c
@@ -217,12 +217,8 @@ static gint pgpinline_check_signature(MimeInfo *mimeinfo)
 static SignatureStatus pgpinline_get_sig_status(MimeInfo *mimeinfo)
 {
 	PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
-	
-	cm_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		pgpinline_check_signature(mimeinfo);
+	cm_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
 
 	return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
 }
@@ -230,13 +226,9 @@ static SignatureStatus pgpinline_get_sig_status(MimeInfo *mimeinfo)
 static gchar *pgpinline_get_sig_info_short(MimeInfo *mimeinfo)
 {
 	PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
-	
+
 	cm_return_val_if_fail(data != NULL, g_strdup("Error"));
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		pgpinline_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
 }
 
@@ -782,6 +774,7 @@ static PrivacySystem pgpinline_system = {
 	pgpinline_encrypt,
 	pgpinline_get_encrypt_warning,
 	pgpinline_inhibit_encrypt_warning,
+	prefs_gpg_auto_check_signatures,
 };
 
 void pgpinline_init()
diff --git a/src/plugins/pgpmime/pgpmime.c b/src/plugins/pgpmime/pgpmime.c
index 30cf043..2a0bb7a 100644
--- a/src/plugins/pgpmime/pgpmime.c
+++ b/src/plugins/pgpmime/pgpmime.c
@@ -241,10 +241,6 @@ static SignatureStatus pgpmime_get_sig_status(MimeInfo *mimeinfo)
 	
 	cm_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		pgpmime_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
 }
 
@@ -254,23 +250,15 @@ static gchar *pgpmime_get_sig_info_short(MimeInfo *mimeinfo)
 	
 	cm_return_val_if_fail(data != NULL, g_strdup("Error"));
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		pgpmime_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
 }
 
 static gchar *pgpmime_get_sig_info_full(MimeInfo *mimeinfo)
 {
 	PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
-	
+
 	cm_return_val_if_fail(data != NULL, g_strdup("Error"));
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		pgpmime_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
 }
 
@@ -781,6 +769,7 @@ static PrivacySystem pgpmime_system = {
 	pgpmime_encrypt,
 	pgpmime_get_encrypt_warning,
 	pgpmime_inhibit_encrypt_warning,
+	prefs_gpg_auto_check_signatures,
 };
 
 void pgpmime_init()
diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index 07e2345..f439796 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -330,10 +330,6 @@ static SignatureStatus smime_get_sig_status(MimeInfo *mimeinfo)
 	
 	cm_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		smime_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
 }
 
@@ -343,10 +339,6 @@ static gchar *smime_get_sig_info_short(MimeInfo *mimeinfo)
 	
 	cm_return_val_if_fail(data != NULL, g_strdup("Error"));
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		smime_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
 }
 
@@ -356,10 +348,6 @@ static gchar *smime_get_sig_info_full(MimeInfo *mimeinfo)
 	
 	cm_return_val_if_fail(data != NULL, g_strdup("Error"));
 
-	if (data->sigstatus == NULL && 
-	    prefs_gpg_get_config()->auto_check_signatures)
-		smime_check_signature(mimeinfo);
-	
 	return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
 }
 
@@ -906,6 +894,7 @@ static PrivacySystem smime_system = {
 	smime_encrypt,
 	smime_get_encrypt_warning,
 	smime_inhibit_encrypt_warning,
+	prefs_gpg_auto_check_signatures,
 };
 
 void smime_init()
diff --git a/src/privacy.c b/src/privacy.c
index cdf2316..ffc61ae 100644
--- a/src/privacy.c
+++ b/src/privacy.c
@@ -501,3 +501,24 @@ gboolean privacy_encrypt(const gchar *id, MimeInfo *mimeinfo, const gchar *encda
 
 	return system->encrypt(mimeinfo, encdata);
 }
+
+gboolean privacy_auto_check_signatures(MimeInfo *mimeinfo)
+{
+	PrivacySystem *system;
+
+	cm_return_val_if_fail(mimeinfo != NULL, FALSE);
+
+	if (mimeinfo->privacy == NULL)
+		privacy_mimeinfo_is_signed(mimeinfo);
+
+	if (mimeinfo->privacy == NULL)
+		return FALSE;
+
+	system = privacy_data_get_system(mimeinfo->privacy);
+	if (system == NULL)
+		return FALSE;
+	if (system->auto_check_signatures == NULL)
+		return FALSE;
+
+	return system->auto_check_signatures();
+}
diff --git a/src/privacy.h b/src/privacy.h
index a0333bd..ebc1919 100644
--- a/src/privacy.h
+++ b/src/privacy.h
@@ -102,6 +102,7 @@ struct _PrivacySystem {
 						 const gchar *encrypt_data);
 	const gchar	*(*get_encrypt_warning)	(void);
 	void 		 (*inhibit_encrypt_warning)	(gboolean inhibit);
+	gboolean	 (*auto_check_signatures)(void);
 };
 
 struct _PrivacyData {
@@ -110,5 +111,6 @@ struct _PrivacyData {
 
 void privacy_inhibit_encrypt_warning		(const gchar *id,
 						 gboolean inhibit);
+gboolean privacy_auto_check_signatures(MimeInfo *mimeinfo);
 
 #endif /* PRIVACY_H */

-----------------------------------------------------------------------

Summary of changes:
 src/mimeview.c                    |   13 ++++++++-----
 src/plugins/pgpcore/prefs_gpg.c   |    5 +++++
 src/plugins/pgpcore/prefs_gpg.h   |    1 +
 src/plugins/pgpinline/pgpinline.c |   13 +++----------
 src/plugins/pgpmime/pgpmime.c     |   15 ++-------------
 src/plugins/smime/smime.c         |   13 +------------
 src/privacy.c                     |   21 +++++++++++++++++++++
 src/privacy.h                     |    2 ++
 8 files changed, 43 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list