aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
author1 <NotZed@Ximian.com>2001-10-22 04:28:58 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-22 04:28:58 +0800
commita02822a94ed38a72f24bc3ea61fdc42cd2ffcb62 (patch)
tree4bd56a134ef4c5a34fa15ff535fe45a38c3566de /mail
parentc435267723233da063f2ffdbc472a687cbc16658 (diff)
downloadgsoc2013-evolution-a02822a94ed38a72f24bc3ea61fdc42cd2ffcb62.tar.gz
gsoc2013-evolution-a02822a94ed38a72f24bc3ea61fdc42cd2ffcb62.tar.zst
gsoc2013-evolution-a02822a94ed38a72f24bc3ea61fdc42cd2ffcb62.zip
Clear variables once done, for debugging. (mail_vfolder_add_uri,
2001-10-21 <NotZed@Ximian.com> * mail-vfolder.c (mail_vfolder_shutdown): Clear variables once done, for debugging. (mail_vfolder_add_uri, mail_vfolder_delete_uri): Dont do anything if we're shutdown (context == NULL). * component-factory.c (idle_quit): Move mail_vfolder_shutdown here, it should be one of the last things shutdown. * mail-format.c (handle_text_plain): Dont use (if (!p++), and then check p!= later, since its now 1, oops. Fixes #13106, thought it was a start of uuencoded stuff! * folder-browser.c (on_right_click): Escape _'s before adding them to menu from mailing list name, also remove some dead code that someone forgot to remove when refactoring. #11307. (folder_browser_is_drafts): Use the store's uri_cmp function to compare to the drafts uri's. (folder_browser_is_sent): Same. Slight cleanup for #11351. svn path=/trunk/; revision=13856
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog21
-rw-r--r--mail/component-factory.c6
-rw-r--r--mail/folder-browser.c53
-rw-r--r--mail/mail-display.c1
-rw-r--r--mail/mail-format.c6
-rw-r--r--mail/mail-vfolder.c15
6 files changed, 65 insertions, 37 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 46153954a8..77258c61d5 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,24 @@
+2001-10-21 <NotZed@Ximian.com>
+
+ * mail-vfolder.c (mail_vfolder_shutdown): Clear variables once
+ done, for debugging.
+ (mail_vfolder_add_uri, mail_vfolder_delete_uri): Dont do anything
+ if we're shutdown (context == NULL).
+
+ * component-factory.c (idle_quit): Move mail_vfolder_shutdown
+ here, it should be one of the last things shutdown.
+
+ * mail-format.c (handle_text_plain): Dont use (if (!p++), and then
+ check p!= later, since its now 1, oops. Fixes #13106, thought it
+ was a start of uuencoded stuff!
+
+ * folder-browser.c (on_right_click): Escape _'s before adding them
+ to menu from mailing list name, also remove some dead code that
+ someone forgot to remove when refactoring. #11307.
+ (folder_browser_is_drafts): Use the store's uri_cmp function to
+ compare to the drafts uri's.
+ (folder_browser_is_sent): Same. Slight cleanup for #11351.
+
2001-10-21 Dan Winship <danw@ximian.com>
* mail-callbacks.c (mail_generate_reply): Update for
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 8ec5fc924b..7962dcdd11 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -799,6 +799,8 @@ idle_quit (gpointer user_data)
g_hash_table_foreach (storages_hash, free_storage, NULL);
g_hash_table_destroy (storages_hash);
+ mail_vfolder_shutdown ();
+
gtk_main_quit ();
return FALSE;
@@ -832,9 +834,7 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
empty_trash (NULL, NULL, NULL);
mail_msg_wait_all();
-
- mail_vfolder_shutdown ();
-
+
unref_standard_folders ();
mail_importer_uninit ();
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 8e9b7807f7..f5deb31499 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -893,17 +893,16 @@ folder_browser_is_drafts (FolderBrowser *fb)
g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE);
- if (fb->uri == NULL)
+ if (fb->uri == NULL || fb->folder == NULL)
return FALSE;
if (fb->folder == drafts_folder)
return TRUE;
-
+
accounts = mail_config_get_accounts ();
while (accounts) {
account = accounts->data;
- if (account->drafts_folder_uri &&
- !strcmp (account->drafts_folder_uri, fb->uri))
+ if (account->drafts_folder_uri && camel_store_uri_cmp(fb->folder->parent_store, account->drafts_folder_uri, fb->uri))
return TRUE;
accounts = accounts->next;
}
@@ -926,7 +925,7 @@ folder_browser_is_sent (FolderBrowser *fb)
g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE);
- if (fb->uri == NULL)
+ if (fb->uri == NULL || fb->folder == NULL)
return FALSE;
if (fb->folder == sent_folder)
@@ -935,8 +934,7 @@ folder_browser_is_sent (FolderBrowser *fb)
accounts = mail_config_get_accounts ();
while (accounts) {
account = accounts->data;
- if (account->sent_folder_uri &&
- !strcmp (account->sent_folder_uri, fb->uri))
+ if (account->sent_folder_uri && camel_store_uri_cmp(fb->folder->parent_store, account->sent_folder_uri, fb->uri))
return TRUE;
accounts = accounts->next;
}
@@ -1493,8 +1491,7 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
int enable_mask = 0;
int hide_mask = 0;
int i;
- char *mailing_list_name = NULL;
- char *subject_match = NULL, *from_match = NULL;
+ char *mlist = NULL;
GtkMenu *menu;
if (fb->folder != sent_folder) {
@@ -1504,22 +1501,23 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
if (fb->mail_display->current_message == NULL) {
enable_mask |= SELECTION_SET;
- mailing_list_name = NULL;
} else {
- /* FIXME: we are leaking subject_match and from_match...what do we use them for anyway??? */
- const char *subject, *real, *addr;
- const CamelInternetAddress *from;
-
- mailing_list_name = header_raw_check_mailing_list(
- &((CamelMimePart *)fb->mail_display->current_message)->headers);
-
- subject = camel_mime_message_get_subject (fb->mail_display->current_message);
- if (subject && (subject = strip_re (subject)) && subject[0])
- subject_match = g_strdup (subject);
-
- from = camel_mime_message_get_from (fb->mail_display->current_message);
- if (from && camel_internet_address_get (from, 0, &real, &addr) && addr && addr[0])
- from_match = g_strdup (addr);
+ char *mname, *p, c, *o;
+
+ mname = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers);
+ /* Escape the mailing list name before showing it */
+ if (mname) {
+ mlist = alloca(strlen(mname)+2);
+ p = mname;
+ o = mlist;
+ while ((c = *p++)) {
+ if (c=='_')
+ *o++='_';
+ *o++ = c;
+ }
+ *o = 0;
+ g_free(mname);
+ }
}
/* get a list of uids */
@@ -1606,14 +1604,13 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
g_ptr_array_free (uids, TRUE);
/* generate the "Filter on Mailing List menu item name */
- if (mailing_list_name == NULL) {
+ if (mlist == NULL) {
enable_mask |= IS_MAILING_LIST;
filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on Mailing List"));
filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on Mailing List"));
} else {
- filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on Mailing List (%s)"), mailing_list_name);
- filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on Mailing List (%s)"), mailing_list_name);
- g_free(mailing_list_name);
+ filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on Mailing List (%s)"), mlist);
+ filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on Mailing List (%s)"), mlist);
}
menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 9ff38085dd..a78ad34af1 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -1304,6 +1304,7 @@ mail_text_write (GtkHTML *html, GtkHTMLStream *stream,
E_TEXT_TO_HTML_CONVERT_SPACES |
(mail_config_get_citation_highlight () ? E_TEXT_TO_HTML_MARK_CITATION : 0),
mail_config_get_citation_color ());
+
gtk_html_write (html, stream, "<tt>", 4);
gtk_html_write (html, stream, htmltext, strlen (htmltext));
gtk_html_write (html, stream, "</tt>", 5);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 27c6cb3677..8aff7262dd 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1173,8 +1173,12 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
* skip over it.
*/
p = strchr (start, '\n');
- if (!p++)
+ /* Last line, drop out, and dump */
+ if (p == NULL) {
+ p = start;
break;
+ }
+ p++;
mail_text_write (md->html, md->stream, "%.*s", p-start, start);
} else if (p)
mail_html_write (md->html, md->stream, "<hr>");
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 12c70d0e0c..2132d8b699 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -305,7 +305,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove)
int remote = (((CamelService *)store)->provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0;
GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name;
- if (CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7))
+ if (CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7) || context == NULL)
return;
g_assert(pthread_self() == mail_gui_thread);
@@ -376,7 +376,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *uri)
CamelVeeFolder *vf;
GString *changed;
- if (CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7))
+ if (context == NULL || CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7))
return;
d(printf("Deleting uri to check: %s\n", uri));
@@ -854,10 +854,15 @@ mail_vfolder_shutdown (void)
{
g_hash_table_foreach (vfolder_hash, vfolder_foreach_cb, NULL);
g_hash_table_destroy (vfolder_hash);
-
- if (vfolder_store)
+ vfolder_hash = NULL;
+
+ if (vfolder_store) {
camel_object_unref (CAMEL_OBJECT (vfolder_store));
+ vfolder_store = NULL;
+ }
- if (context)
+ if (context) {
gtk_object_unref (GTK_OBJECT (context));
+ context = NULL;
+ }
}