[Commits] [SCM] claws branch, master, updated. 3.17.0-132-gbfc9552

claws at claws-mail.org claws at claws-mail.org
Thu Oct 25 11:36:59 CEST 2018


The branch, master has been updated
       via  bfc95529975d50e8cda7a85b439aab23f2021c53 (commit)
      from  75b8d8cbbb9eb23d591272ed694249db2dda61fe (commit)

Summary of changes:
 src/compose.c |   45 +++++++++++++++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit bfc95529975d50e8cda7a85b439aab23f2021c53
Author: Paul <paul at claws-mail.org>
Date:   Thu Oct 25 10:36:54 2018 +0100

    don't leave the user in limbo when privacy system is 'none' and auto signing/encrypting is set

diff --git a/src/compose.c b/src/compose.c
index 11e0b6e..7a0b68e 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2018 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1010,6 +1010,13 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 	compose = compose_create(account, item, COMPOSE_NEW, FALSE);
 	compose_apply_folder_privacy_settings(compose, item);
 
+	if (privacy_system_can_sign(compose->privacy_system) == FALSE &&
+	    (account->default_encrypt || account->default_sign))
+		alertpanel_error(_("You have opted to sign and/or encrypt this "
+				   "message but have not selected a privacy system.\n\n"
+				   "Signing and encrypting have been disabled for this "
+				   "message."));
+
 	/* override from name if mailto asked for it */
 	if (mailto_from) {
 		gtk_entry_set_text(GTK_ENTRY(compose->from_name), mailto_from);
@@ -1273,7 +1280,8 @@ static void compose_force_encryption(Compose *compose, PrefsAccount *account,
 	cm_return_if_fail(compose != NULL);
 	cm_return_if_fail(account != NULL);
 
-	if (override_pref == FALSE && account->default_encrypt_reply == FALSE)
+	if (privacy_system_can_encrypt(compose->privacy_system) == FALSE ||
+	    (override_pref == FALSE && account->default_encrypt_reply == FALSE))
 		return;
 
 	if (account->default_privacy_system && strlen(account->default_privacy_system))
@@ -1310,6 +1318,8 @@ static void compose_force_encryption(Compose *compose, PrefsAccount *account,
 static void compose_force_signing(Compose *compose, PrefsAccount *account, const gchar *system)
 {
 	const gchar *privacy = NULL;
+	if (privacy_system_can_sign(compose->privacy_system) == FALSE)
+		return;
 
 	if (account->default_privacy_system && strlen(account->default_privacy_system))
 		privacy = account->default_privacy_system;
@@ -1679,6 +1689,13 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
 	}
 	g_free(s_system);
 
+	if (privacy_system_can_sign(compose->privacy_system) == FALSE &&
+	    (account->default_encrypt_reply || account->default_sign_reply))
+		alertpanel_error(_("You have opted to sign and/or encrypt this "
+				   "message but have not selected a privacy system.\n\n"
+				   "Signing and encrypting have been disabled for this "
+				   "message."));
+
 	SIGNAL_BLOCK(textbuf);
 	
 	if (account->auto_sig)
@@ -4951,16 +4968,18 @@ static void compose_select_account(Compose *compose, PrefsAccount *account,
 
 	compose_set_title(compose);
 
-	if (account->default_sign && compose->mode != COMPOSE_REDIRECT)
+	compose_activate_privacy_system(compose, account, FALSE);
+
+	if (account->default_sign && privacy_system_can_sign(compose->privacy_system) &&
+	    compose->mode != COMPOSE_REDIRECT)
 		cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", TRUE);
 	else
 		cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", FALSE);
-	if (account->default_encrypt && compose->mode != COMPOSE_REDIRECT)
+	if (account->default_encrypt && privacy_system_can_encrypt(compose->privacy_system) &&
+	    compose->mode != COMPOSE_REDIRECT)
 		cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", TRUE);
 	else
 		cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", FALSE);
-				       
-	compose_activate_privacy_system(compose, account, FALSE);
 
 	if (!init && compose->mode != COMPOSE_REDIRECT) {
 		undo_block(compose->undostruct);
@@ -8271,6 +8290,14 @@ static Compose *compose_create(PrefsAccount *account,
 #endif
 
 	compose_select_account(compose, account, TRUE);
+	if (folder->prefs && folder->prefs->save_copy_to_folder) {
+		gchar *folderidentifier;
+
+    		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), TRUE);
+		folderidentifier = folder_item_get_identifier(folder);
+		compose_set_save_to(compose, folderidentifier);
+		g_free(folderidentifier);
+	}
 
 	cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoWrap", prefs_common.autowrap);
 	cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoIndent", prefs_common.auto_indent);
@@ -11540,11 +11567,13 @@ static void compose_activate_privacy_system(Compose *compose, PrefsAccount *acco
 static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item)
 {
 	if (folder_item != NULL) {
-		if (folder_item->prefs->always_sign != SIGN_OR_ENCRYPT_DEFAULT) {
+		if (folder_item->prefs->always_sign != SIGN_OR_ENCRYPT_DEFAULT &&
+		    privacy_system_can_sign(compose->privacy_system)) {
 			compose_use_signing(compose,
 				(folder_item->prefs->always_sign == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE);
 		}
-		if (folder_item->prefs->always_encrypt != SIGN_OR_ENCRYPT_DEFAULT) {
+		if (folder_item->prefs->always_encrypt != SIGN_OR_ENCRYPT_DEFAULT &&
+		    privacy_system_can_encrypt(compose->privacy_system)) {
 			compose_use_encryption(compose,
 				(folder_item->prefs->always_encrypt == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE);
 		}

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list