diff options
author | Not Zed <NotZed@Ximian.com> | 2002-03-25 20:11:44 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-03-25 20:11:44 +0800 |
commit | c6fc4e27a953c5213cff8400ec8e40f6f051e914 (patch) | |
tree | 7237e42f705cd584d36f3a2a4795a1bb16741dd3 /camel/providers/local/camel-local-folder.c | |
parent | ede63cde5882af8696c22ed546506ad877b73011 (diff) | |
download | gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.gz gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.zst gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.zip |
When we add a new name, up all of the cache limits, because we're probably
2002-03-25 Not Zed <NotZed@Ximian.com>
* camel-text-index.c (text_index_add_name): When we add a new
name, up all of the cache limits, because we're probably going to
be adding more.
(text_index_sync): Drop the cache limits back down again, we dont
need them when looking words up.
** MERGE camel_index branch.
* camel-text-index.[ch]: Added files i forgot to add (eep nearly
lost all this work!)
* camel-block-file.c (sync_nolock): Fix an infinite loop in syncing.
svn path=/trunk/; revision=16242
Diffstat (limited to 'camel/providers/local/camel-local-folder.c')
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index d84041025c..0344fc8952 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -50,6 +50,8 @@ #include "camel-local-private.h" +#include "camel-text-index.h" + #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/ #ifndef PATH_MAX @@ -138,9 +140,8 @@ local_finalize(CamelObject * object) camel_object_unref((CamelObject *)local_folder->search); } - /* must free index after summary, since it isn't refcounted */ if (local_folder->index) - ibex_close(local_folder->index); + camel_object_unref((CamelObject *)local_folder->index); while (local_folder->locked> 0) camel_local_folder_unlock(local_folder); @@ -211,10 +212,17 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con lf->changes = camel_folder_change_info_new(); - /* if we have no index file, force it */ - forceindex = stat(lf->index_path, &st) == -1; + /* TODO: Remove the following line, it is a temporary workaround to remove + the old-format 'ibex' files that might be lying around */ + unlink(lf->index_path); + + /* if we have no/invalid index file, force it */ + forceindex = camel_text_index_check(lf->index_path) == -1; if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) { - lf->index = ibex_open(lf->index_path, O_CREAT | O_RDWR, 0600); + int flag = O_RDWR|O_CREAT; + if (forceindex) + flag |= O_TRUNC; + lf->index = (CamelIndex *)camel_text_index_new(lf->index_path, flag); if (lf->index == NULL) { /* yes, this isn't fatal at all */ g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno)); @@ -223,10 +231,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX; } } else { - /* if we do have an index file, remove it */ - if (forceindex == FALSE) { - unlink(lf->index_path); - } + /* if we do have an index file, remove it (?) */ + if (forceindex == FALSE) + camel_text_index_remove(lf->index_path); forceindex = FALSE; } @@ -237,7 +244,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con camel_exception_clear(ex); } - if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) { + /*if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {*/ + /* we sync here so that any hard work setting up the folder isn't lost */ + if (camel_local_summary_sync((CamelLocalSummary *)folder->summary, FALSE, lf->changes, ex) == -1) { camel_object_unref (CAMEL_OBJECT (folder)); return NULL; } |