From ee5eeb1dd21eee94538ffafe27cb58bc80d0d306 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 18 Oct 2000 06:13:12 +0000 Subject: No, we REALLY dont want to perform an immediate search as the keys are 2000-10-18 Not Zed * folder-browser.c (folder_browser_gui_init): No, we REALLY dont want to perform an immediate search as the keys are pressed. * mail-display.c (on_object_requested): Kill a minor warning with a cast. * mail-config.c: Include mising ctype.h to kill a warning. * message-thread.c (main): Fixed the test case for api changes. * message-list.c (message_list_drag_data_get): Set some flags to get_folder(). I dont even think this will work because mail_tool_get_folder doesn't handle file url's. * mail-vfolder.c (vfolder_uri_to_folder): Pass appropriate flags. * mail-ops.c (do_setup_folder): Pass appropriate flags. Hmm, whats the difference between setup and create. *shrug* (do_create_folder): Pass appropriate flags to get_folder. Needs a way to specify the index flag. * mail-tools.c (mail_tool_get_folder_from_urlname): Changed create to flags argument. (mail_tool_get_local_inbox_url): Add an index argument. (mail_tool_get_local_inbox): honour index flag. (mail_tool_get_inbox): Changed for api change. (mail_tool_uri_to_folder): Fixed calls to store_get_folder(); * mail-local.c (load_metainfo): Added an indexed field to the metainfo. (save_metainfo): And save it too. (do_reconfigure_folder): Honour index flag when creating the new folder. Do not open the old folder with an index at all. (mail_local_map_uri): Add an index argument - tells if the mbox is indexed. (mail_tool_local_uri_to_folder): Create & pass flags properly. (#include gnome.h): Dont include all of gnome, just what we use, and explicity include xml-memory, so we get xmlFree(). svn path=/trunk/; revision=5979 --- mail/mail-local.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'mail/mail-local.c') diff --git a/mail/mail-local.c b/mail/mail-local.c index 04ca6fe0d1..a852b7c183 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -33,8 +33,9 @@ #include #endif #include -#include +#include #include +#include #include "Evolution.h" #include "evolution-storage.h" @@ -60,6 +61,7 @@ struct _local_meta { char *format; /* format of mailbox */ char *name; /* name of mbox itself */ + int indexed; /* do we index the body? */ }; static struct _local_meta * @@ -85,8 +87,16 @@ load_metainfo(const char *path) node = node->childs; while (node) { if (!strcmp(node->name, "folder")) { + char *index; meta->format = xmlGetProp(node, "type"); meta->name = xmlGetProp(node, "name"); + index = xmlGetProp(node, "index"); + if (index) { + meta->indexed = atoi(index); + xmlFree(index); + } else + meta->indexed = TRUE; + } node = node->next; } @@ -96,6 +106,7 @@ load_metainfo(const char *path) dodefault: meta->format = g_strdup("mbox"); /* defaults */ meta->name = g_strdup("mbox"); + meta->indexed = TRUE; if (doc) xmlFreeDoc(doc); return meta; @@ -126,6 +137,7 @@ save_metainfo(struct _local_meta *meta) node = xmlNewChild(root, NULL, "folder", NULL); xmlSetProp(node, "type", meta->format); xmlSetProp(node, "name", meta->name); + xmlSetProp(node, "index", meta->indexed?"1":"0"); ret = xmlSaveFile(meta->path, doc); xmlFreeDoc(doc); @@ -134,7 +146,7 @@ save_metainfo(struct _local_meta *meta) /* maps a local uri to the real type */ char * -mail_local_map_uri(const char *uri) +mail_local_map_uri(const char *uri, int *index) { CamelURL *url; char *metapath; @@ -142,6 +154,9 @@ mail_local_map_uri(const char *uri) struct _local_meta *meta; CamelException *ex; + if (index) + *index = TRUE; + if (strncmp(uri, "file:", 5)) { g_warning("Trying to map non-local uri: %s", uri); return g_strdup(uri); @@ -159,6 +174,9 @@ mail_local_map_uri(const char *uri) meta = load_metainfo(metapath); g_free(metapath); + if (index) + *index = meta->indexed; + /* change file: to format: */ camel_url_set_protocol(url, meta->format); storename = camel_url_to_string(url, TRUE); @@ -175,6 +193,7 @@ mail_tool_local_uri_to_folder(const char *uri, CamelException *ex) char *storename; CamelFolder *folder = NULL; struct _local_meta *meta; + int flags; if (strncmp(uri, "file:", 5)) { return NULL; @@ -197,8 +216,11 @@ mail_tool_local_uri_to_folder(const char *uri, CamelException *ex) storename = camel_url_to_string(url, TRUE); printf("store name is %s\n", storename); + flags = 0; + if (meta->indexed) + flags |= CAMEL_STORE_FOLDER_BODY_INDEX; - folder = mail_tool_get_folder_from_urlname (storename, meta->name, FALSE, ex); + folder = mail_tool_get_folder_from_urlname (storename, meta->name, flags, ex); camel_url_free(url); g_free (storename); free_metainfo(meta); @@ -297,6 +319,7 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex) char *uri; CamelURL *url = NULL; struct _local_meta *meta; + guint32 flags; printf("reconfiguring folder: %s to type %s\n", input->fb->uri, input->newtype); @@ -342,7 +365,7 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex) if (camel_exception_is_set(ex)) goto cleanup; - /* rename the old mbox and open it again */ + /* rename the old mbox and open it again, without indexing */ tmpname = g_strdup_printf("%s_reconfig", meta->name); printf("renaming %s to %s, and opening it\n", meta->name, tmpname); update_progress("Renaming old folder and opening", 0.0); @@ -353,8 +376,9 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex) mail_tool_camel_lock_down (); goto cleanup; } - - fromfolder = camel_store_get_folder(fromstore, tmpname, TRUE, ex); + + /* we dont need to set the create flag ... or need an index if it has one */ + fromfolder = camel_store_get_folder(fromstore, tmpname, 0, ex); if (fromfolder == NULL || camel_exception_is_set(ex)) { /* try and recover ... */ camel_exception_clear (ex); @@ -367,7 +391,10 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex) printf("Creating the destination mbox\n"); update_progress("Creating new folder", 0.0); - tofolder = camel_store_get_folder(tostore, meta->name, TRUE, ex); + flags = CAMEL_STORE_FOLDER_CREATE; + if (meta->indexed) + flags |= CAMEL_STORE_FOLDER_BODY_INDEX; + tofolder = camel_store_get_folder(tostore, meta->name, flags, ex); if (tofolder == NULL || camel_exception_is_set(ex)) { printf("cannot open destination folder\n"); /* try and recover ... */ -- cgit