diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-06-26 03:55:00 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-06-26 03:55:00 +0800 |
commit | 83f5888387c17fd95faf4c75117a5768ac7a4825 (patch) | |
tree | 0822cf6c1cf442d910c5cfb3476d62027b23d33c | |
parent | c22378ec3d57a2d351d663819e2c3da97e81101f (diff) | |
download | gsoc2013-evolution-83f5888387c17fd95faf4c75117a5768ac7a4825.tar.gz gsoc2013-evolution-83f5888387c17fd95faf4c75117a5768ac7a4825.tar.zst gsoc2013-evolution-83f5888387c17fd95faf4c75117a5768ac7a4825.zip |
Some compiler warning fixes.
2002-06-25 Jeffrey Stedfast <fejj@ximian.com>
* component-factory.c (mail_add_storage): Some compiler warning
fixes.
* mail-crypto.c (mail_crypto_pgp_mime_part_sign): Removed.
(mail_crypto_get_pgp_cipher_context): New convenience function to
construct a pgp cipher context.
(mail_crypto_pgp_mime_part_verify): Use the new
get_pgp_cipher_context function.
(mail_crypto_pgp_mime_part_encrypt): Same.
(mail_crypto_pgp_mime_part_decrypt): Here too.
* mail-account-gui.c (mail_account_gui_new): Initialise the
pgp_always_trust checkbox.
(mail_account_gui_save): Get whether or not to always_trust the
user's pgp keys.
* mail-config.c (account_copy): Copy over the pgp_always_trust
option.
(config_read): Read in the always_trust option.
(mail_config_write): Save the always_trust option.
svn path=/trunk/; revision=17277
-rw-r--r-- | mail/ChangeLog | 23 | ||||
-rw-r--r-- | mail/component-factory.c | 6 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 3 | ||||
-rw-r--r-- | mail/mail-account-gui.h | 1 | ||||
-rw-r--r-- | mail/mail-config.c | 10 | ||||
-rw-r--r-- | mail/mail-config.glade | 16 | ||||
-rw-r--r-- | mail/mail-config.h | 1 | ||||
-rw-r--r-- | mail/mail-crypto.c | 67 | ||||
-rw-r--r-- | mail/mail-crypto.h | 6 |
9 files changed, 70 insertions, 63 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index c9465a00af..08282b04ea 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,26 @@ +2002-06-25 Jeffrey Stedfast <fejj@ximian.com> + + * component-factory.c (mail_add_storage): Some compiler warning + fixes. + + * mail-crypto.c (mail_crypto_pgp_mime_part_sign): Removed. + (mail_crypto_get_pgp_cipher_context): New convenience function to + construct a pgp cipher context. + (mail_crypto_pgp_mime_part_verify): Use the new + get_pgp_cipher_context function. + (mail_crypto_pgp_mime_part_encrypt): Same. + (mail_crypto_pgp_mime_part_decrypt): Here too. + + * mail-account-gui.c (mail_account_gui_new): Initialise the + pgp_always_trust checkbox. + (mail_account_gui_save): Get whether or not to always_trust the + user's pgp keys. + + * mail-config.c (account_copy): Copy over the pgp_always_trust + option. + (config_read): Read in the always_trust option. + (mail_config_write): Save the always_trust option. + 2002-06-21 Jeffrey Stedfast <fejj@ximian.com> * mail-crypto.c (mail_crypto_pgp_mime_part_verify): If the pgp diff --git a/mail/component-factory.c b/mail/component-factory.c index 5384bbd249..e42e9128f9 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -1297,11 +1297,11 @@ mail_add_storage (CamelStore *store, const char *name, const char *uri) if (name == NULL) { char *service_name; - service_name = camel_service_get_name (store, TRUE); - add_storage (service_name, uri, store, shell, &ex); + service_name = camel_service_get_name ((CamelService *) store, TRUE); + add_storage (service_name, uri, (CamelService *) store, shell, &ex); g_free (service_name); } else { - add_storage (name, uri, store, shell, &ex); + add_storage (name, uri, (CamelService *) store, shell, &ex); } camel_exception_clear (&ex); diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index c89c71180f..111b59a67c 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -1478,6 +1478,8 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog) gtk_toggle_button_set_active (gui->pgp_encrypt_to_self, account->pgp_encrypt_to_self); gui->pgp_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_sign")); gtk_toggle_button_set_active (gui->pgp_always_sign, account->pgp_always_sign); + gui->pgp_always_trust = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_trust")); + gtk_toggle_button_set_active (gui->pgp_always_trust, account->pgp_always_trust); #if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key")); @@ -1900,6 +1902,7 @@ mail_account_gui_save (MailAccountGui *gui) account->pgp_key = e_utf8_gtk_entry_get_text (gui->pgp_key); account->pgp_encrypt_to_self = gtk_toggle_button_get_active (gui->pgp_encrypt_to_self); account->pgp_always_sign = gtk_toggle_button_get_active (gui->pgp_always_sign); + account->pgp_always_trust = gtk_toggle_button_get_active (gui->pgp_always_trust); #if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) g_free (account->smime_key); diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h index b9469f54b1..f378cc63f5 100644 --- a/mail/mail-account-gui.h +++ b/mail/mail-account-gui.h @@ -107,6 +107,7 @@ typedef struct { GtkEntry *pgp_key; GtkToggleButton *pgp_encrypt_to_self; GtkToggleButton *pgp_always_sign; + GtkToggleButton *pgp_always_trust; GtkEntry *smime_key; GtkToggleButton *smime_encrypt_to_self; GtkToggleButton *smime_always_sign; diff --git a/mail/mail-config.c b/mail/mail-config.c index 033f9d646f..4c2192cf40 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -265,6 +265,7 @@ account_copy (const MailConfigAccount *account) new->pgp_key = g_strdup (account->pgp_key); new->pgp_encrypt_to_self = account->pgp_encrypt_to_self; new->pgp_always_sign = account->pgp_always_sign; + new->pgp_always_trust = account->pgp_always_trust; new->smime_key = g_strdup (account->smime_key); new->smime_encrypt_to_self = account->smime_encrypt_to_self; @@ -685,6 +686,11 @@ config_read (void) config->db, path, TRUE, NULL); g_free (path); + path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_trust_%d", i); + account->pgp_always_trust = bonobo_config_get_boolean_with_default ( + config->db, path, FALSE, NULL); + g_free (path); + /* get the s/mime info */ path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i); val = bonobo_config_get_string (config->db, path, NULL); @@ -1087,6 +1093,10 @@ mail_config_write (void) account->pgp_encrypt_to_self, NULL); g_free (path); + path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_trust_%d", i); + bonobo_config_set_boolean (config->db, path, account->pgp_always_trust, NULL); + g_free (path); + /* account s/mime options */ path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i); bonobo_config_set_string_wrapper (config->db, path, account->smime_key, NULL); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index ef84672b4a..acc414b65e 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -2090,7 +2090,7 @@ Kerberos <widget> <class>GtkVBox</class> - <name>vbox69</name> + <name>vboxPGP</name> <border_width>3</border_width> <homogeneous>False</homogeneous> <spacing>3</spacing> @@ -2168,6 +2168,20 @@ Kerberos <fill>False</fill> </child> </widget> + + <widget> + <class>GtkCheckButton</class> + <name>pgp_always_trust</name> + <can_focus>True</can_focus> + <label>Always _trust keys in my keyring when encrypting</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> </widget> </widget> diff --git a/mail/mail-config.h b/mail/mail-config.h index 0a100be221..47c6a293c5 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -75,6 +75,7 @@ typedef struct { char *pgp_key; gboolean pgp_encrypt_to_self; gboolean pgp_always_sign; + gboolean pgp_always_trust; char *smime_key; gboolean smime_encrypt_to_self; diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c index fbd2f4bda5..70cc620684 100644 --- a/mail/mail-crypto.c +++ b/mail/mail-crypto.c @@ -33,24 +33,22 @@ /** - * mail_crypto_pgp_mime_part_sign: - * @mime_part: a MIME part that will be replaced by a pgp signed part - * @userid: userid to sign with - * @hash: one of CAMEL_CIPHER_HASH_MD5 or CAMEL_CIPHER_HASH_SHA1 - * @ex: exception which will be set if there are any errors. + * mail_crypto_get_pgp_cipher_context: + * @account: Account that will be using this context * - * Constructs a PGP/MIME multipart in compliance with rfc2015 and - * replaces #part with the generated multipart/signed. On failure, - * #ex will be set and #part will remain untouched. + * Constructs a new PGP (or GPG) cipher context with the appropriate + * options set based on the account provided. **/ -void -mail_crypto_pgp_mime_part_sign (CamelMimePart **mime_part, const char *userid, CamelCipherHash hash, CamelException *ex) +CamelCipherContext * +mail_crypto_get_pgp_cipher_context (const MailConfigAccount *account) { CamelCipherContext *cipher; switch (mail_config_get_pgp_type ()) { case CAMEL_PGP_TYPE_GPG: cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ()); + if (account) + camel_gpg_context_set_always_trust ((CamelGpgContext *) cipher, account->pgp_always_trust); break; case CAMEL_PGP_TYPE_PGP5: case CAMEL_PGP_TYPE_PGP6: @@ -62,12 +60,7 @@ mail_crypto_pgp_mime_part_sign (CamelMimePart **mime_part, const char *userid, C break; } - if (cipher) { - camel_pgp_mime_part_sign (cipher, mime_part, userid, hash, ex); - camel_object_unref (CAMEL_OBJECT (cipher)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a PGP signature context.")); + return cipher; } @@ -84,19 +77,7 @@ mail_crypto_pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex) CamelCipherValidity *valid = NULL; CamelCipherContext *cipher; - switch (mail_config_get_pgp_type ()) { - case CAMEL_PGP_TYPE_GPG: - cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ()); - break; - case CAMEL_PGP_TYPE_PGP5: - case CAMEL_PGP_TYPE_PGP6: - cipher = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - break; - default: - cipher = NULL; - break; - } + cipher = mail_crypto_get_pgp_cipher_context (NULL); if (cipher) { valid = camel_pgp_mime_part_verify (cipher, mime_part, ex); @@ -124,19 +105,7 @@ mail_crypto_pgp_mime_part_encrypt (CamelMimePart **mime_part, GPtrArray *recipie { CamelCipherContext *cipher; - switch (mail_config_get_pgp_type ()) { - case CAMEL_PGP_TYPE_GPG: - cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ()); - break; - case CAMEL_PGP_TYPE_PGP5: - case CAMEL_PGP_TYPE_PGP6: - cipher = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - break; - default: - cipher = NULL; - break; - } + cipher = mail_crypto_get_pgp_cipher_context (NULL); if (cipher) { camel_pgp_mime_part_encrypt (cipher, mime_part, recipients, ex); @@ -160,19 +129,7 @@ mail_crypto_pgp_mime_part_decrypt (CamelMimePart *mime_part, CamelException *ex) CamelCipherContext *cipher; CamelMimePart *part = NULL; - switch (mail_config_get_pgp_type ()) { - case CAMEL_PGP_TYPE_GPG: - cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ()); - break; - case CAMEL_PGP_TYPE_PGP5: - case CAMEL_PGP_TYPE_PGP6: - cipher = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - break; - default: - cipher = NULL; - break; - } + cipher = mail_crypto_get_pgp_cipher_context (NULL); if (cipher) { part = camel_pgp_mime_part_decrypt (cipher, mime_part, ex); diff --git a/mail/mail-crypto.h b/mail/mail-crypto.h index 1ed794ceb5..f573625ce6 100644 --- a/mail/mail-crypto.h +++ b/mail/mail-crypto.h @@ -27,6 +27,7 @@ #include <camel/camel-pgp-mime.h> #include <camel/camel-smime-context.h> #include <camel/camel-smime-utils.h> +#include "mail-config.h" #ifdef __cplusplus extern "C" { @@ -34,10 +35,7 @@ extern "C" { #endif /* __cplusplus */ /* PGP/MIME convenience wrappers */ -void mail_crypto_pgp_mime_part_sign (CamelMimePart **mime_part, - const char *userid, - CamelCipherHash hash, - CamelException *ex); +CamelCipherContext *mail_crypto_get_pgp_cipher_context (const MailConfigAccount *account); CamelCipherValidity *mail_crypto_pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex); |