diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 51 | ||||
-rw-r--r-- | mail/mail-accounts.c | 11 | ||||
-rw-r--r-- | mail/mail-accounts.h | 7 | ||||
-rw-r--r-- | mail/mail-config.c | 105 | ||||
-rw-r--r-- | mail/mail-config.glade | 14 | ||||
-rw-r--r-- | mail/mail-config.h | 3 | ||||
-rw-r--r-- | mail/mail-crypto.c | 12 |
7 files changed, 136 insertions, 67 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 68d75e100e..17dab48fb2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,17 +1,35 @@ +2001-07-09 Jeffrey Stedfast <fejj@ximian.com> + + * mail-crypto.c (mail_crypto_pgp_mime_part_sign): Update to pass + in the `remember' argument when creating a new pgp context. + (mail_crypto_pgp_mime_part_verify): Same. + (mail_crypto_pgp_mime_part_encrypt): And here... + (mail_crypto_pgp_mime_part_decrypt): And finally here. + + * mail-config.c (mail_config_get_remember_pgp_passphrase): New. + (mail_config_set_remember_pgp_passphrase): New. + (config_read): Read in the "remember passphrase" value. + (mail_config_write_on_exit): Save the remember-passphrase value. + + * mail-accounts.c (construct): Allow the user to set "Remember PGP + Passphrase". + (remember_pgp_passphrase_toggled): Set the toggle state. + 2001-07-09 Peter Williams <peterw@ximian.com> - * mail-ops.c (get_folderinfo_got): Check for an exception and print it. - Call done anyway. + * mail-ops.c (get_folderinfo_got): Check for an exception and + print it. Call done anyway. (do_update_subfolders): Check for NULL info. 2001-07-09 Peter Williams <peterw@ximian.com> - * mail-config.c (mail_config_write): Some NULL protection for our strings: - pgp_key, html_signature, smime_key. Probably we should do this for all - strings. Either that or change Bonobo Config. + * mail-config.c (mail_config_write): Some NULL protection for our + strings: pgp_key, html_signature, smime_key. Probably we should do + this for all strings. Either that or change Bonobo Config. - * message-list.c (message_list_init): Explicitly initialize search to NULL. - Bug 3951 might to be due to a problem wrt this, and it can't hurt. + * message-list.c (message_list_init): Explicitly initialize search + to NULL. Bug 3951 might to be due to a problem wrt this, and it + can't hurt. 2001-07-09 Dan Winship <danw@ximian.com> @@ -32,24 +50,25 @@ 2001-07-09 Peter Williams <peterw@ximian.com> - * mail-config.c (mail_config_write): Change html_signature stuff over - to bonobo-config -- someone forgot to do this. + * mail-config.c (mail_config_write): Change html_signature stuff + over to bonobo-config -- someone forgot to do this. - * mail-folder-cache.c (dm): Gave up and got rid of dm. Just replaced it - with d(g_message()) and set G_LOG_DOMAIN. + * mail-folder-cache.c (dm): Gave up and got rid of dm. Just + replaced it with d(g_message()) and set G_LOG_DOMAIN. 2001-07-09 Peter Williams <peterw@ximian.com> - * mail-folder-cache.c (mail_folder_cache_set_update_shellview): Deleted + * mail-folder-cache.c (mail_folder_cache_set_update_shellview): + Deleted (as opposed to #if 0) (get_folder_info): Changed to assume it has the folder lock. (make_folder_name): Same. (make_folder_status): Same. (update_idle): Don't unlock around the make_folder_ functions. - (*): Changed behavior wrt. get_folder_info. Lock before calling, but - also move preconditions before -- get_folder_info can only return NULL - if uri is NULL. Also add preconditions for other arguments where - necessary. + (*): Changed behavior wrt. get_folder_info. Lock before calling, + but also move preconditions before -- get_folder_info can only + return NULL if uri is NULL. Also add preconditions for other + arguments where necessary. 2001-07-07 Christopher James Lahey <clahey@ximian.com> diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index edb147f49d..e4e02fe61d 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -648,6 +648,12 @@ empty_trash_toggled (GtkWidget *toggle, gpointer data) } static void +remember_pgp_passphrase_toggled (GtkWidget *toggle, gpointer data) +{ + mail_config_set_remember_pgp_passphrase (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); +} + +static void prompt_empty_subject_toggled (GtkWidget *toggle, gpointer data) { mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); @@ -797,6 +803,11 @@ construct (MailAccountsDialog *dialog) gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->pgp_path)), "changed", GTK_SIGNAL_FUNC (pgp_path_changed), dialog); + dialog->remember_passwd = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkRememberPGPPassphrase")); + gtk_toggle_button_set_active (dialog->remember_passwd, mail_config_get_remember_pgp_passphrase ()); + gtk_signal_connect (GTK_OBJECT (dialog->remember_passwd), "toggled", + GTK_SIGNAL_FUNC (remember_pgp_passphrase_toggled), dialog); + dialog->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); menu = e_charset_picker_new (mail_config_get_default_charset ()); gtk_option_menu_set_menu (dialog->charset, menu); diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h index f0ece925d9..765ab399ec 100644 --- a/mail/mail-accounts.h +++ b/mail/mail-accounts.h @@ -54,7 +54,7 @@ struct _MailAccountsDialog { const GSList *accounts; gint accounts_row; - + /* Accounts page */ GtkCList *mail_accounts; GtkButton *mail_add; @@ -65,7 +65,7 @@ struct _MailAccountsDialog { const GSList *news; gint news_row; - + /* News page */ GtkCList *news_accounts; GtkButton *news_add; @@ -77,7 +77,7 @@ struct _MailAccountsDialog { GnomeColorPicker *citation_color; GtkSpinButton *timeout; GtkToggleButton *images_always, *images_sometimes, *images_never; - + /* Composer page */ GtkToggleButton *send_html; GtkOptionMenu *forward_style; @@ -89,6 +89,7 @@ struct _MailAccountsDialog { /* PGP page */ GnomeFileEntry *pgp_path; + GtkToggleButton *remember_passwd; }; typedef struct _MailAccountsDialog MailAccountsDialog; diff --git a/mail/mail-config.c b/mail/mail-config.c index de98723925..67eee583a9 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -73,6 +73,7 @@ typedef struct { char *pgp_path; CamelPgpType pgp_type; + gboolean remember_pgp_passphrase; MailConfigHTTPMode http_mode; MailConfigForwardStyle default_forward_style; @@ -510,10 +511,13 @@ config_read (void) /* PGP/GPG */ config->pgp_path = bonobo_config_get_string (config->db, "/Mail/PGP/path", NULL); - + config->pgp_type = bonobo_config_get_long_with_default (config->db, "/Mail/PGP/type", CAMEL_PGP_TYPE_NONE, NULL); - + + config->remember_pgp_passphrase = bonobo_config_get_boolean_with_default ( + config->db, "/Mail/PGP/remember_passphrase", TRUE, NULL); + /* HTTP images */ config->http_mode = bonobo_config_get_long_with_default (config->db, "/Mail/Display/http_images", MAIL_CONFIG_HTTP_SOMETIMES, NULL); @@ -527,11 +531,11 @@ config_read (void) config->message_display_style = bonobo_config_get_long_with_default ( config->db, "/Mail/Format/message_display_style", MAIL_CONFIG_DISPLAY_NORMAL, NULL); - + /* Default charset */ config->default_charset = bonobo_config_get_string (config->db, "/Mail/Format/default_charset", NULL); - + if (!config->default_charset) { g_get_charset (&config->default_charset); if (!config->default_charset || @@ -540,7 +544,7 @@ config_read (void) else config->default_charset = g_strdup (config->default_charset); } - + /* Trash folders */ config->empty_trash_on_exit = bonobo_config_get_boolean_with_default ( config->db, "/Mail/Trash/empty_on_exit", FALSE, NULL); @@ -553,10 +557,10 @@ mail_config_write (void) gint len, i, default_num; /* Accounts */ - + if (!config) return; - + CORBA_exception_init (&ev); Bonobo_ConfigDatabase_removeDir (config->db, "/Mail/Accounts", &ev); CORBA_exception_init (&ev); @@ -567,11 +571,11 @@ mail_config_write (void) len = g_slist_length (config->accounts); bonobo_config_set_long (config->db, "/Mail/Accounts/num", len, NULL); - + default_num = mail_config_get_default_account_num (); bonobo_config_set_long (config->db, "/Mail/Accounts/default_account", default_num, NULL); - + for (i = 0; i < len; i++) { MailConfigAccount *account; gchar *path; @@ -582,22 +586,22 @@ mail_config_write (void) path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); bonobo_config_set_string (config->db, path, account->name, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i); bonobo_config_set_string (config->db, path, account->drafts_folder_name, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i); bonobo_config_set_string (config->db, path, account->drafts_folder_uri, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i); bonobo_config_set_string (config->db, path, account->sent_folder_name, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i); bonobo_config_set_string (config->db, path, account->sent_folder_uri, NULL); @@ -610,7 +614,7 @@ mail_config_write (void) else bonobo_config_set_string (config->db, path, "", NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); bonobo_config_set_boolean (config->db, path, account->pgp_encrypt_to_self, NULL); @@ -625,7 +629,7 @@ mail_config_write (void) bonobo_config_set_string (config->db, path, "", NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i); bonobo_config_set_boolean (config->db, path, account->smime_encrypt_to_self, @@ -637,17 +641,17 @@ mail_config_write (void) bonobo_config_set_string (config->db, path, account->id->name, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i); bonobo_config_set_string (config->db, path, account->id->address, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i); bonobo_config_set_string (config->db, path, account->id->organization, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i); bonobo_config_set_string (config->db, path, account->id->signature, NULL); @@ -668,29 +672,29 @@ mail_config_write (void) account->source->url ? account->source->url : "", NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i); bonobo_config_set_boolean (config->db, path, account->source->keep_on_server, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i); bonobo_config_set_boolean (config->db, path, account->source->auto_check, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i); bonobo_config_set_long (config->db, path, account->source->auto_check_time, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i); bonobo_config_set_boolean (config->db, path, account->source->enabled, NULL); g_free (path); - + path = g_strdup_printf ("/Mail/Accounts/source_save_passwd_%d", i); bonobo_config_set_boolean (config->db, path, account->source->save_passwd, NULL); @@ -712,7 +716,7 @@ mail_config_write (void) #ifdef ENABLE_NNTP /* News */ - + len = g_slist_length (config->news); bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL); for (i = 0; i < len; i++) { @@ -725,7 +729,7 @@ mail_config_write (void) bonobo_config_set_string (config->db, path, n->url, NULL); g_free (path); } - + #endif CORBA_exception_init (&ev); @@ -762,7 +766,7 @@ mail_config_write_on_exit (void) /* Show Message Preview */ bonobo_config_set_boolean (config->db, "/Mail/Display/preview_pane", config->show_preview, NULL); - + /* Hide deleted automatically */ bonobo_config_set_boolean (config->db, "Mail/Display/hide_deleted", config->hide_deleted, NULL); @@ -770,7 +774,7 @@ mail_config_write_on_exit (void) /* Size of vpaned in mail view */ bonobo_config_set_long (config->db, "Mail/Display/paned_size", config->paned_size, NULL); - + /* Mark as seen timeout */ bonobo_config_set_long (config->db, "/Mail/Display/seen_timeout", config->seen_timeout, NULL); @@ -783,7 +787,7 @@ mail_config_write_on_exit (void) bonobo_config_set_boolean (config->db, "/Mail/Display/citation_highlight", config->citation_highlight, NULL); - + bonobo_config_set_long (config->db, "/Mail/Display/citation_color", config->citation_color, NULL); @@ -794,18 +798,21 @@ mail_config_write_on_exit (void) /* Only Bcc */ bonobo_config_set_boolean (config->db, "/Mail/Prompts/only_bcc", config->prompt_only_bcc, NULL); - + /* PGP/GPG */ bonobo_config_set_string (config->db, "/Mail/PGP/path", config->pgp_path, NULL); - + bonobo_config_set_long (config->db, "/Mail/PGP/type", config->pgp_type, NULL); + bonobo_config_set_boolean (config->db, "/Mail/Prompts/remember_passphrase", + config->remember_pgp_passphrase, NULL); + /* HTTP images */ bonobo_config_set_long (config->db, "/Mail/Display/http_images", config->http_mode, NULL); - + /* Forwarding */ bonobo_config_set_long (config->db, "/Mail/Format/default_forward_style", @@ -815,7 +822,7 @@ mail_config_write_on_exit (void) bonobo_config_set_long (config->db, "/Mail/Format/message_display_style", config->message_display_style, NULL); - + /* Default charset */ bonobo_config_set_string (config->db, "/Mail/Format/default_charset", config->default_charset, NULL); @@ -823,18 +830,17 @@ mail_config_write_on_exit (void) /* Trash folders */ bonobo_config_set_boolean (config->db, "/Mail/Trash/empty_on_exit", config->empty_trash_on_exit, NULL); - - + g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads"); - + g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview"); - + CORBA_exception_init (&ev); Bonobo_ConfigDatabase_sync (config->db, &ev); CORBA_exception_free (&ev); - + /* Passwords */ /* fixme: still depends on gnome-config */ gnome_config_private_clean_section ("/Evolution/Passwords"); @@ -863,20 +869,19 @@ uri_to_key (const char *uri) { char *rval; int i = 0; - + if (!uri) return NULL; - + rval = g_strdup (uri); - - while (rval [i]) { - + + while (rval [i]) { if (rval [i] == '/' || rval [i] == ':') rval [i] = '_'; - + i++; } - + return rval; } @@ -1202,6 +1207,18 @@ mail_config_set_pgp_path (const char *pgp_path) config->pgp_path = g_strdup (pgp_path); } +gboolean +mail_config_get_remember_pgp_passphrase (void) +{ + return config->remember_pgp_passphrase; +} + +void +mail_config_set_remember_pgp_passphrase (gboolean value) +{ + config->remember_pgp_passphrase = value; +} + MailConfigHTTPMode mail_config_get_http_mode (void) { diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 3fcc2bba07..f0590975ef 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -2712,6 +2712,20 @@ Quoted </widget> <widget> + <class>GtkCheckButton</class> + <name>chkPGPRemeberPassphrase</name> + <can_focus>True</can_focus> + <label>Remember PGP Passphrase until exit</label> + <active>True</active> + <draw_indicator>True</draw_indicator> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> <class>GtkHBox</class> <name>hbox56</name> <homogeneous>False</homogeneous> diff --git a/mail/mail-config.h b/mail/mail-config.h index 4a3167f6b9..0d012ec046 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -145,6 +145,9 @@ void mail_config_set_pgp_type (CamelPgpType pgp_type); const char *mail_config_get_pgp_path (void); void mail_config_set_pgp_path (const char *pgp_path); +gboolean mail_config_get_remember_pgp_passphrase (void); +void mail_config_set_remember_pgp_passphrase (gboolean value); + MailConfigHTTPMode mail_config_get_http_mode (void); void mail_config_set_http_mode (MailConfigHTTPMode); diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c index bad81e5539..f7e003f07c 100644 --- a/mail/mail-crypto.c +++ b/mail/mail-crypto.c @@ -49,7 +49,8 @@ mail_crypto_pgp_mime_part_sign (CamelMimePart **mime_part, const char *userid, C CamelPgpContext *context; context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); + mail_config_get_pgp_path (), + mail_config_get_pgp_remember_pgp_passphrase ()); if (context) { camel_pgp_mime_part_sign (context, mime_part, userid, hash, ex); @@ -74,7 +75,8 @@ mail_crypto_pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex) CamelPgpContext *context; context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); + mail_config_get_pgp_path (), + mail_config_get_pgp_remember_pgp_passphrase ()); if (context) { valid = camel_pgp_mime_part_verify (context, mime_part, ex); @@ -103,7 +105,8 @@ mail_crypto_pgp_mime_part_encrypt (CamelMimePart **mime_part, GPtrArray *recipie CamelPgpContext *context; context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); + mail_config_get_pgp_path (), + mail_config_get_pgp_remember_pgp_passphrase ()); if (context) { camel_pgp_mime_part_encrypt (context, mime_part, recipients, ex); @@ -128,7 +131,8 @@ mail_crypto_pgp_mime_part_decrypt (CamelMimePart *mime_part, CamelException *ex) CamelMimePart *part = NULL; context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); + mail_config_get_pgp_path (), + mail_config_get_pgp_remember_pgp_passphrase ()); if (context) { part = camel_pgp_mime_part_decrypt (context, mime_part, ex); |