diff options
-rw-r--r-- | mail/ChangeLog | 29 | ||||
-rw-r--r-- | mail/mail-account-editor.c | 21 | ||||
-rw-r--r-- | mail/mail-account-editor.h | 12 | ||||
-rw-r--r-- | mail/mail-config-druid.c | 6 | ||||
-rw-r--r-- | mail/mail-config.c | 10 | ||||
-rw-r--r-- | mail/mail-config.glade | 238 | ||||
-rw-r--r-- | mail/mail-config.h | 2 | ||||
-rw-r--r-- | mail/mail-format.c | 23 | ||||
-rw-r--r-- | mail/mail-tools.c | 4 | ||||
-rw-r--r-- | mail/mail-vtrash.c | 44 | ||||
-rw-r--r-- | mail/openpgp-utils.c | 44 |
11 files changed, 392 insertions, 41 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index ce4268018c..f38dbdf3a7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,34 @@ 2001-02-22 Jeffrey Stedfast <fejj@ximian.com> + * openpgp-utils.c (openpgp_verify): Fixed memory corruption bug. + + * mail-format.c (try_inline_pgp_sig): Check to make sure the + validity isn't NULL. + (handle_multipart_signed): Check for NULL validities. + +2001-02-21 Jeffrey Stedfast <fejj@ximian.com> + + * mail-tools.c (mail_tool_uri_to_folder): Protect against NULL + uri's. + + * mail-vtrash.c: Do mutex locking on the global hash table - this + should clear up some segfaults ;-) + + * mail-config-druid.c (druid_finish): Set the 'enabled' member of + the source to TRUE if the URL exists else set to FALSE. + (incoming_type_changed): If the provider chosen is "None" then + gray-out the auto-check widgets and the check-settings, otherwise + sensitize them. + + * mail-account-editor.c (construct): Added a few more settings. + (apply_changes): Save the new settings. + + * mail-config.c (service_copy): Updated. + (config_read): Read in whether or not the account is enabled. + (mail_config_write): Save if the account is enabled or not. + +2001-02-22 Jeffrey Stedfast <fejj@ximian.com> + * mail-ops.c (mail_send_message): Updated to reflect changes to the filter-driver code. diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index 5ce5db255b..526f0b57c2 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -197,6 +197,10 @@ apply_changes (MailAccountEditor *editor) account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active; account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active; + account->source->enabled = GTK_TOGGLE_BUTTON (editor->source_enabled)->active; + account->source->auto_check = GTK_TOGGLE_BUTTON (editor->source_auto_check)->active; + account->source->auto_check_time = gtk_spin_button_get_value_as_int (editor->source_auto_timeout); + if (editor->source_ssl) account->source->use_ssl = GTK_TOGGLE_BUTTON (editor->source_ssl)->active; @@ -542,6 +546,14 @@ transport_type_init (MailAccountEditor *editor, CamelURL *url) } static void +auto_check_toggled (GtkToggleButton *button, gpointer data) +{ + MailAccountEditor *editor = data; + + gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), button->active); +} + +static void source_check (MailAccountEditor *editor, CamelURL *url) { GList *providers, *l; @@ -747,6 +759,15 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_ssl), account->source->use_ssl); editor->keep_on_server = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkKeepMailOnServer")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->keep_on_server), account->source->keep_on_server); + editor->source_auto_timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinAutoCheckTimeout")); + gtk_spin_button_set_value (editor->source_auto_timeout, + (gfloat) (account->source->auto_check_time * 1.0)); + editor->source_auto_check = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAutoCheckMail")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_auto_check), account->source->auto_check); + gtk_signal_connect (GTK_OBJECT (editor->source_auto_check), "toggled", auto_check_toggled, editor); + gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), account->source->auto_check); + editor->source_enabled = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkEnabled")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_enabled), account->source->enabled); source_check (editor, url); source_auth_init (editor, url); if (url) diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h index d9c318ea8d..a750bdedb6 100644 --- a/mail/mail-account-editor.h +++ b/mail/mail-account-editor.h @@ -46,6 +46,7 @@ struct _MailAccountEditor { GladeXML *gui; + /* Identity / General */ GtkEntry *account_name; GtkEntry *name; GtkEntry *email; @@ -53,6 +54,7 @@ struct _MailAccountEditor { GtkEntry *organization; GnomeFileEntry *signature; + /* Source */ GtkWidget *source_type; /* this is generic because we don't know the widget-type */ GtkEntry *source_host; GtkEntry *source_user; @@ -62,13 +64,19 @@ struct _MailAccountEditor { GtkOptionMenu *source_auth; GtkCheckButton *source_ssl; + GtkCheckButton *keep_on_server; + + GtkCheckButton *source_auto_check; + GtkSpinButton *source_auto_timeout; + + GtkCheckButton *source_enabled; + + /* Transport */ GtkWidget *transport_type; /* Same here... */ GtkEntry *transport_host; GtkOptionMenu *transport_auth; GtkCheckButton *transport_ssl; - GtkCheckButton *keep_on_server; - const CamelProvider *transport; }; diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 8b9ae57019..58014c7430 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -217,8 +217,10 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) mail_session_remember_password (source->url); } camel_url_free (url); + source->enabled = TRUE; } else { source->url = NULL; + source->enabled = FALSE; } /* construct the transport */ @@ -434,6 +436,10 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data) druid->source_provider = provider; + gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check), provider ? TRUE : FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), provider ? TRUE : FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_check_settings), provider ? TRUE : FALSE); + /* hostname */ label = glade_xml_get_widget (druid->gui, "lblSourceHost"); if (provider && provider->url_flags & CAMEL_URL_ALLOW_HOST) { diff --git a/mail/mail-config.c b/mail/mail-config.c index cdb98cd0f9..7817386cb7 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -102,6 +102,7 @@ service_copy (const MailConfigService *source) new->keep_on_server = source->keep_on_server; new->auto_check = source->auto_check; new->auto_check_time = source->auto_check_time; + new->enabled = source->enabled; new->save_passwd = source->save_passwd; new->use_ssl = source->use_ssl; @@ -274,6 +275,11 @@ config_read (void) if (source->auto_check && def) source->auto_check = FALSE; g_free (path); + path = g_strdup_printf ("source_enabled_%d", i); + source->enabled = gnome_config_get_bool_with_default (path, &def); + if (def) + source->enabled = TRUE; + g_free (path); path = g_strdup_printf ("source_save_passwd_%d", i); source->save_passwd = gnome_config_get_bool (path); g_free (path); @@ -389,6 +395,7 @@ mail_config_write (void) /* Accounts */ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir); gnome_config_clean_section (str); + gnome_config_sync (); gnome_config_push_prefix (str); g_free (str); @@ -435,6 +442,9 @@ mail_config_write (void) path = g_strdup_printf ("source_auto_check_time_%d", i); gnome_config_set_int (path, account->source->auto_check_time); g_free (path); + path = g_strdup_printf ("source_enabled_%d", i); + gnome_config_set_bool (path, account->source->enabled); + g_free (path); path = g_strdup_printf ("source_save_passwd_%d", i); gnome_config_set_bool (path, account->source->save_passwd); g_free (path); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index c30d6baba0..da0f2fc57b 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -2568,7 +2568,7 @@ SMTP <widget> <class>GtkTable</class> <name>tableServerTimeouts</name> - <rows>3</rows> + <rows>5</rows> <columns>10</columns> <homogeneous>True</homogeneous> <row_spacing>0</row_spacing> @@ -2699,6 +2699,104 @@ SMTP <yfill>False</yfill> </child> </widget> + + <widget> + <class>GtkCheckButton</class> + <name>chkEnabled</name> + <can_focus>True</can_focus> + <label>Include in "Get Mail" operations.</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox40</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkCheckButton</class> + <name>chkAutoCheckMail</name> + <can_focus>True</can_focus> + <label>Automatically check mail every</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkSpinButton</class> + <name>spinAutoCheckTimeout</name> + <can_focus>True</can_focus> + <climb_rate>1</climb_rate> + <digits>0</digits> + <numeric>True</numeric> + <update_policy>GTK_UPDATE_ALWAYS</update_policy> + <snap>False</snap> + <wrap>False</wrap> + <value>10</value> + <lower>0</lower> + <upper>100</upper> + <step>1</step> + <page>10</page> + <page_size>10</page_size> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblMinutes</name> + <label>minutes.</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> </widget> </widget> @@ -3120,4 +3218,142 @@ SMTP </widget> </widget> +<widget> + <class>GnomeDialog</class> + <name>editor</name> + <visible>False</visible> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>True</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>True</auto_shrink> + <auto_close>False</auto_close> + <hide_on_close>False</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>dialog-vbox4</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>dialog-action_area4</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button2</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button3</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> + <class>GtkNotebook</class> + <name>toplevel</name> + <can_focus>True</can_focus> + <show_tabs>True</show_tabs> + <show_border>True</show_border> + <tab_pos>GTK_POS_TOP</tab_pos> + <scrollable>False</scrollable> + <tab_hborder>2</tab_hborder> + <tab_vborder>2</tab_vborder> + <popup_enable>False</popup_enable> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>Placeholder</class> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblGeneral</name> + <label>General</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>Placeholder</class> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblSource</name> + <label>Source</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>Placeholder</class> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblTransport</name> + <label>Transport</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + </widget> + </widget> +</widget> + </GTK-Interface> diff --git a/mail/mail-config.h b/mail/mail-config.h index ee9191a4c8..852049ccc0 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -44,6 +44,8 @@ typedef struct { gboolean keep_on_server; gboolean auto_check; gint auto_check_time; + gboolean enabled; + gboolean save_passwd; gboolean use_ssl; } MailConfigService; diff --git a/mail/mail-format.c b/mail/mail-format.c index 7517ac95bd..27849d54b7 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -119,7 +119,7 @@ add_url (char *url, gpointer data, MailDisplay *md) urls = g_datalist_get_data (md->data, "urls"); g_return_val_if_fail (urls != NULL, NULL); - + if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) { g_free (url); url = old_key; @@ -1010,7 +1010,7 @@ try_inline_pgp_sig (char *start, MailDisplay *md) g_free (plaintext); /* Now display the "seal-of-authenticity" or something... */ - if (openpgp_validity_get_valid (valid)) { + if (valid && openpgp_validity_get_valid (valid)) { mail_html_write (md->html, md->stream, "<hr>\n<table><tr valign=top>" "<td><img src=\"%s\"></td>" @@ -1028,7 +1028,7 @@ try_inline_pgp_sig (char *start, MailDisplay *md) "not be proven to be authentic.")); } - if (openpgp_validity_get_description (valid)) { + if (valid && openpgp_validity_get_description (valid)) { mail_error_write (md->html, md->stream, openpgp_validity_get_description (valid)); mail_html_write (md->html, md->stream, "<br><br>"); @@ -1339,6 +1339,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, CamelException ex; wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); /* Currently we only handle RFC2015-style PGP encryption. */ @@ -1372,6 +1373,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, int nparts, i; wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); /* Currently we only handle RFC2015-style PGP signatures. */ @@ -1395,7 +1397,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, } /* Now display the "seal-of-authenticity" or something... */ - if (openpgp_validity_get_valid (valid)) { + if (valid && openpgp_validity_get_valid (valid)) { mail_html_write (md->html, md->stream, "<hr>\n<table><tr valign=top>" "<td><img src=\"%s\"></td>" @@ -1413,7 +1415,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, "not be proven to be authentic.")); } - if (openpgp_validity_get_description (valid)) { + if (valid && openpgp_validity_get_description (valid)) { mail_error_write (md->html, md->stream, openpgp_validity_get_description (valid)); mail_html_write (md->html, md->stream, "<br><br>"); @@ -1441,6 +1443,7 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type, int i, nparts; g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + mp = CAMEL_MULTIPART (wrapper); nparts = camel_multipart_get_number (mp); @@ -1523,10 +1526,11 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type, camel_medium_get_content_object (CAMEL_MEDIUM (part)); CamelMultipart *multipart; CamelMimePart *mime_part; - + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + multipart = CAMEL_MULTIPART (wrapper); - + mime_part = find_preferred_alternative (multipart, FALSE); if (mime_part) return call_handler_function (mime_part, md); @@ -1544,6 +1548,7 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type, CamelMultipart *multipart; g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + multipart = CAMEL_MULTIPART (wrapper); /* The first part is application/applefile and is not useful @@ -1560,9 +1565,9 @@ handle_message_rfc822 (CamelMimePart *part, const char *mime_type, { CamelDataWrapper *wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - + g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE); - + mail_html_write (md->html, md->stream, "<blockquote>"); mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md); mail_html_write (md->html, md->stream, "</blockquote>"); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 06efcd4a2f..ba457bd4cd 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -309,6 +309,8 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex) CamelStore *store = NULL; CamelFolder *folder = NULL; + g_return_val_if_fail (uri != NULL, NULL); + /* FIXME: This is a hack. */ if (!strncmp (uri, "vtrash:", 7)) { folder = vtrash_uri_to_folder (uri, ex); @@ -319,7 +321,7 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex) url = camel_url_new (uri, ex); if (!url) return NULL; - + if (!strcmp (url->protocol, "vfolder")) { folder = vfolder_uri_to_folder (uri, ex); } else { diff --git a/mail/mail-vtrash.c b/mail/mail-vtrash.c index 134ce558f5..ff76756e73 100644 --- a/mail/mail-vtrash.c +++ b/mail/mail-vtrash.c @@ -42,7 +42,11 @@ #define d(x) +#define VTRASH_LOCK(x) pthread_mutex_lock(&x) +#define VTRASH_UNLOCK(x) pthread_mutex_unlock(&x) + static GHashTable *vtrash_hash = NULL; +static pthread_mutex_t vtrash_hash_lock = PTHREAD_MUTEX_INITIALIZER; extern char *evolution_dir; extern CamelSession *session; @@ -51,17 +55,20 @@ extern CamelSession *session; CamelFolder * vtrash_uri_to_folder (const char *uri, CamelException *ex) { - CamelFolder *folder; + CamelFolder *folder = NULL; - if (!vtrash_hash) - return NULL; + g_return_val_if_fail (uri != NULL, NULL); if (strncmp (uri, "vtrash:", 7)) - return NULL; + return NULL; - folder = g_hash_table_lookup (vtrash_hash, uri); - - camel_object_ref (CAMEL_OBJECT (folder)); + VTRASH_LOCK (vtrash_hash_lock); + if (vtrash_hash) { + folder = g_hash_table_lookup (vtrash_hash, uri); + + camel_object_ref (CAMEL_OBJECT (folder)); + } + VTRASH_UNLOCK (vtrash_hash_lock); return folder; } @@ -76,9 +83,12 @@ vtrash_add (CamelStore *store, CamelFolder *folder, const char *store_uri, const uri = g_strdup_printf ("vtrash:%s", store_uri); + VTRASH_LOCK (vtrash_hash_lock); + if (!vtrash_hash) { vtrash_hash = g_hash_table_new (g_str_hash, g_str_equal); } else if (g_hash_table_lookup (vtrash_hash, uri) != NULL) { + VTRASH_UNLOCK (vtrash_hash_lock); g_free (uri); return; } @@ -90,6 +100,7 @@ vtrash_add (CamelStore *store, CamelFolder *folder, const char *store_uri, const } if (!storage) { + VTRASH_UNLOCK (vtrash_hash_lock); g_free (uri); return; } @@ -99,10 +110,12 @@ vtrash_add (CamelStore *store, CamelFolder *folder, const char *store_uri, const "mail", uri, name, FALSE); gtk_object_unref (GTK_OBJECT (storage)); + g_free (path); + g_hash_table_insert (vtrash_hash, uri, folder); camel_object_ref (CAMEL_OBJECT (folder)); - g_free (path); + VTRASH_UNLOCK (vtrash_hash_lock); } struct _get_trash_msg { @@ -138,7 +151,9 @@ create_trash_vfolder (const char *name, GPtrArray *urls, CamelException *ex) foldername = g_strdup ("mbox?(match-all (system-flag \"Deleted\"))"); /* we dont have indexing on vfolders */ - folder = mail_tool_get_folder_from_urlname (storeuri, foldername, CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_VEE_FOLDER_AUTO, ex); + folder = mail_tool_get_folder_from_urlname (storeuri, foldername, + CAMEL_STORE_FOLDER_CREATE | CAMEL_STORE_VEE_FOLDER_AUTO, + ex); g_free (foldername); g_free (storeuri); if (camel_exception_is_set (ex)) @@ -284,9 +299,12 @@ free_folder (gpointer key, gpointer value, gpointer data) void vtrash_cleanup (void) { - if (!vtrash_hash) - return; + VTRASH_LOCK (vtrash_hash_lock); + + if (vtrash_hash) { + g_hash_table_foreach (vtrash_hash, free_folder, NULL); + g_hash_table_destroy (vtrash_hash); + } - g_hash_table_foreach (vtrash_hash, free_folder, NULL); - g_hash_table_destroy (vtrash_hash); + VTRASH_UNLOCK (vtrash_hash_lock); } diff --git a/mail/openpgp-utils.c b/mail/openpgp-utils.c index 278dac0cdf..bb57036e60 100644 --- a/mail/openpgp-utils.c +++ b/mail/openpgp-utils.c @@ -1139,9 +1139,10 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca if (diagnostics) { char *charset; - char *desc; + const char *buf; + char *desc, *outbuf; iconv_t cd; - size_t len, inlen; + size_t len, outlen; charset = getenv ("CHARSET"); if (!charset) @@ -1149,14 +1150,18 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca cd = iconv_open ("UTF-8", charset); - inlen = strlen (diagnostics); - len = 2 * inlen; - desc = g_malloc0 (len); - if (iconv (cd, (const char **) &diagnostics, &inlen, &desc, &len) == -1) { + len = strlen (diagnostics); + outlen = 2 * len; + + outbuf = desc = g_malloc0 (outlen + 1); + buf = diagnostics; + if (cd == (iconv_t) -1 || iconv (cd, &buf, &len, &outbuf, &outlen) == -1) { g_free (desc); desc = g_strdup (diagnostics); } - iconv_close (cd); + + if (cd != (iconv_t) -1) + iconv_close (cd); openpgp_validity_set_description (valid, desc); g_free (desc); @@ -1174,13 +1179,19 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca PgpValidity * openpgp_validity_new (void) { - return g_new0 (PgpValidity, 1); + PgpValidity *validity; + + validity = g_new (PgpValidity, 1); + validity->valid = FALSE; + validity->description = NULL; + + return validity; } void openpgp_validity_init (PgpValidity *validity) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); validity->valid = FALSE; validity->description = NULL; @@ -1189,7 +1200,8 @@ openpgp_validity_init (PgpValidity *validity) gboolean openpgp_validity_get_valid (PgpValidity *validity) { - g_return_val_if_fail (validity != NULL, FALSE); + if (validity == NULL) + return FALSE; return validity->valid; } @@ -1197,7 +1209,7 @@ openpgp_validity_get_valid (PgpValidity *validity) void openpgp_validity_set_valid (PgpValidity *validity, gboolean valid) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); validity->valid = valid; } @@ -1205,7 +1217,8 @@ openpgp_validity_set_valid (PgpValidity *validity, gboolean valid) gchar * openpgp_validity_get_description (PgpValidity *validity) { - g_return_val_if_fail (validity != NULL, NULL); + if (validity == NULL) + return NULL; return validity->description; } @@ -1213,7 +1226,7 @@ openpgp_validity_get_description (PgpValidity *validity) void openpgp_validity_set_description (PgpValidity *validity, const gchar *description) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); g_free (validity->description); validity->description = g_strdup (description); @@ -1222,7 +1235,7 @@ openpgp_validity_set_description (PgpValidity *validity, const gchar *descriptio void openpgp_validity_clear (PgpValidity *validity) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); validity->valid = FALSE; g_free (validity->description); @@ -1232,7 +1245,8 @@ openpgp_validity_clear (PgpValidity *validity) void openpgp_validity_free (PgpValidity *validity) { - g_return_if_fail (validity != NULL); + if (validity == NULL) + return; g_free (validity->description); g_free (validity); |